-
Notifications
You must be signed in to change notification settings - Fork 16
/
ddb-dm-screen.user.js
1470 lines (1337 loc) · 96.8 KB
/
ddb-dm-screen.user.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
// ==UserScript==
// @name D&DBeyond DM Screen
// @namespace https://github.com/TeaWithLucas/DNDBeyond-DM-Screen/
// @version 3.3.4
// @description Advanced DM screen for D&DBeyond campaigns
// @author TeaWithLucas
// @match https://www.dndbeyond.com/campaigns/*
// @updateURL https://github.com/TeaWithLucas/DNDBeyond-DM-Screen/raw/master/ddb-dm-screen.user.js
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @require https://media.dndbeyond.com/character-tools/vendors~characterTools.bundle.dec3c041829e401e5940.min.js
// @grant GM_setValue
// @grant GM_getValue
// @license MIT; https://github.com/TeaWithLucas/DNDBeyond-DM-Screen/blob/master/LICENSE
// ==/UserScript==
console.log("D&DBeyond DM Screen Starting");
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Script Globals
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
const linkUrlTarget = '.ddb-campaigns-character-card-footer-links-item-view';
const campaignElementTarget = '.ddb-campaigns-detail-header-secondary';
const rulesUrls = ["https://character-service.dndbeyond.com/character/v4/rule-data", "https://gamedata-service.dndbeyond.com/vehicles/v3/rule-data"];
const charJSONurlBase = "https://character-service.dndbeyond.com/character/v4/character/";
const stylesheetUrls = ["https://raw.githack.com/TeaWithLucas/DNDBeyond-DM-Screen/master/dm-screen.css"]
const gameCollectionUrl = {prefix :"https://character-service.dndbeyond.com/character/v4/game-data/", postfix: "/collection"}
const optionalRules = {
"optionalOrigins": {category:"racial-trait", id:"racialTraitId" },
"optionalClassFeatures": {category:"class-feature", id:"classFeatureId" },
};
const scriptVarPrefix = "DMScreen-";
const charIDRegex = /\/(\d+)\/*$/;
const campaignIDRegex = /\/(\d+)\/*$/;
const FEET_IN_MILES = 5280;
const POUNDS_IN_TON = 2000;
const positiveSign = '+', negativeSign = '-';
const autoUpdateDefault = true;
const updateDurationDefault = 60;
const showAbilitiesDefault = true;
const showSavingThrowsDefault = true;
const showSensesDefault = true;
const showClassesDefault = true;
const showResourcesDefault = true;
const currenciesDefault = {gold : 0};
const currenciesTypeDefault = {
platinum : { name: 'Platinum', conversion: 10 },
gold : { name: 'Gold', conversion: 1 },
electrum : { name: 'Electrum', conversion: 0.5 },
silver : { name: 'Silver', conversion: 0.1 },
copper : { name: 'Copper', conversion: 0.01 },
};
const currenciesMainDefault = 'gold';
var $ = window.jQuery;
var rulesData = {}, charactersData = {}, campaignID = 0, campaignNode = {}, authHeaders ={};
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// SVG Data
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var savingThrowRowBowSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 116.1 34" class="ddbc-svg ddbc-saving-throw-row-box-svg ddbc-svg--empty"><g id="SavingThrowRowBoxSvg-Page-1_1_"><g id="SavingThrowRowBoxSvg-Sheet_Desktop_Static" transform="translate(-683.000000, -651.000000)"><path fill="#d8d8d8" id="SavingThrowRowBoxSvg-Page-1" d="M789.8,651h-22l-0.3,0.2c-1.2,0.8-2.3,1.7-3.2,2.7h-75.6l-0.3,0.4c-0.7,1.2-3,4.5-4.9,5.4l-0.5,0.2l0,16.1l0.5,0.2c1.8,0.9,4.1,4.2,4.9,5.4l0.3,0.4h75.6c1,1,2.1,1.9,3.2,2.7l0.3,0.2h21.9l0.3-0.2c5.6-3.8,9-10,9-16.8s-3.4-13-9-16.8L789.8,651z M797.1,668c0,5.8-2.9,11.2-7.6,14.5h-10.3c-4.7-2.1-11.1-3.2-14.3-3.8c-2.3-3-3.7-6.8-3.7-10.7v0c0-3.9,1.3-7.7,3.7-10.7c3.1-0.6,9.5-1.7,14.3-3.8h10.3C794.3,656.8,797.1,662.2,797.1,668L797.1,668z M752.8,655.6c0.8,0.7,2.5,1.8,5.7,2.1c-0.9,1.5-3,5.5-3,10.3s2,8.8,3,10.3c-3.2,0.3-4.9,1.4-5.7,2.1h-55.4c-3.1-1.1-11.1-4.5-12.9-9.3l0-6.2c1.9-4.8,9.9-8.1,12.9-9.3H752.8z M759.6,657.8c0.6,0,1.3,0,2,0c-1.8,3.1-2.8,6.6-2.8,10.3v0c0,3.7,1,7.2,2.9,10.3c-0.7,0-1.3-0.1-2,0c-0.6-1-3.1-5.2-3.1-10.2S759,658.8,759.6,657.8L759.6,657.8z M768.9,682.5c-1.1-0.8-2.1-1.7-3-2.6c2.4,0.5,5.1,1.3,8.3,2.6H768.9L768.9,682.5z M762.2,679.3c0.3,0.4,0.5,0.7,0.8,1.1h-8.5C755.9,679.7,758.3,678.9,762.2,679.3L762.2,679.3z M689.3,680.4c-0.7-1.1-2.8-4.1-4.9-5.4v-1.9c2.3,3.4,7.1,5.9,10.4,7.3H689.3L689.3,680.4z M684.4,661c2.1-1.3,4.2-4.3,4.9-5.4h5.5c-3.3,1.4-8,3.9-10.4,7.3V661L684.4,661z M763,655.6c-0.3,0.4-0.5,0.7-0.8,1.1c-3.9,0.4-6.3-0.4-7.7-1.1H763z M765.9,656.1c0.9-1,1.9-1.9,3-2.6h5.3C771,654.8,768.2,655.6,765.9,656.1L765.9,656.1z"></path></g></g></svg>`;
var abilityScoreBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 81 95" class="ddbc-svg ddbc-ability-score-box-svg "><path fill="#FEFEFE" d="M77.56,53.81a4.55,4.55,0,0,1-1.64-3.69c0-6.29-1.3-14.52,1.37-20.68A5,5,0,0,1,76,26.51a5.3,5.3,0,0,1-.72-6c1.28-2.68,1.17-6.68.88-9.54a4.15,4.15,0,0,1,1.22-3.27c.12-.62.23-1.24.35-1.86C73.47,7.49,70.86,2,70.86,2H10.14S8,6.44,4.48,6.16A5.61,5.61,0,0,1,4.63,7.5c0,1.54-.17,3.1-.21,4.66.09,1.24.23,2.47.44,3.68a33,33,0,0,1,1.58,7.78,4.58,4.58,0,0,1-1.05,3.21,4.79,4.79,0,0,1-1.47,2.34,5.17,5.17,0,0,1,.5,2.12c.18,6.94.78,13.53.25,20.5a5,5,0,0,1-1.2,3c.06,2,0,4,0,6.07a4.61,4.61,0,0,1,.44,3.71C1.64,73,6.36,78,12.35,82.16a5.16,5.16,0,0,1,.49.21c.91.5,1.81,1,2.73,1.55a1,1,0,0,0,.17.1c.54.3,1.09.59,1.66.85a2.39,2.39,0,0,1,.21.13h1.85a4.21,4.21,0,0,1-1.19-1.92,9.45,9.45,0,0,1-.9-6.13,3.71,3.71,0,0,1,.18-1.22c.16-.41.32-.79.49-1.15A10.44,10.44,0,0,1,21,70.26c.11-.12.21-.25.32-.36a14.53,14.53,0,0,1,1.91-1.84,18.26,18.26,0,0,1,6-3.17,21.13,21.13,0,0,1,4.9-1.39c6.15-1.45,14.34-.72,19.85,2.51.67.3,1.33.62,1.94,1a6.52,6.52,0,0,1,.67.45l.07,0a14.44,14.44,0,0,1,4,3.33,4.51,4.51,0,0,1,.77,1,22.47,22.47,0,0,1,1.29,1.89,4.61,4.61,0,0,1,.57,3.41,5.42,5.42,0,0,1,.27,1.78,5.73,5.73,0,0,1-.27,2.33,5.11,5.11,0,0,1-1.29,3.1,3.79,3.79,0,0,1-.66.72h2.68a4.41,4.41,0,0,1,2.21-1.49c1.34-.86,2.74-1.65,4.06-2.61,1.7-1.26,5.14-3.55,5.9-5.61A5.51,5.51,0,0,1,76.8,74a7.8,7.8,0,0,0,.37-1.71,5.4,5.4,0,0,1,.34-1.56c-.09-1.51-.18-3-.41-4.53a6.21,6.21,0,0,1,.5-3.74C77.46,59.57,77.46,56.64,77.56,53.81Z"></path><path fill="#FEFEFE" d="M40.5,66C50.7,66,59,71.61,59,78.5S50.7,91,40.5,91,22,85.39,22,78.5,30.3,66,40.5,66"></path><path fill="#972e2e" d="M4.52,13.62A34.66,34.66,0,0,1,3.08,6.26l0-.42.63-.2C5.22,5.18,9.41,3.35,9.41,1V0H71.59V1c0,2.37,4.19,4.2,5.66,4.66l.63.2,0,.42a35.34,35.34,0,0,1-1.44,7.36L76,7.3C74.42,6.71,70.47,5,69.74,2H11.26C10.52,5,6.58,6.71,5,7.3ZM2.32,79.46H2.6c.08-1.12.16-2.38.24-3.76A13,13,0,0,1,.63,69.83,9.4,9.4,0,0,1,3.21,62.6V61.43S1.83,35.67.56,31.56L.4,31l.47-.29a12.31,12.31,0,0,0,2.2-1.87,6.23,6.23,0,0,0,1.55-2.24A5.08,5.08,0,0,0,5,23.27c0-.11-.58-1.35-1.12-3l-.26,2.85c.27.79.5,1.63.71,2.49a5.17,5.17,0,0,1-1.56,2A33.13,33.13,0,0,0,1.74,23.6l-.07-.2L2.91,9.63c0,2,1.38,6.53,1.38,6.53a36.23,36.23,0,0,0,2.1,6.67A7.13,7.13,0,0,1,5,28.71C6.68,38,5.08,71,4.87,74.89A15.6,15.6,0,0,1,3,71.41c.08-2,.13-4.16.16-6.41a7.57,7.57,0,0,0-1.15,4.71,12,12,0,0,0,2.1,5.41l.15.22.45.64.06.07h0a29.64,29.64,0,0,0,5.74,5.66A39.48,39.48,0,0,1,14,83.83h0l.26.18c.79.54,1.55,1.09,2.29,1.65l.18.13h0c1.42,1.09,2.71,2.17,3.78,3.11,1.39,0,2.75.11,4,.22a16.4,16.4,0,0,1-3.19-3.33H17.91l-2.49-2h2.32a16.19,16.19,0,0,1-.88-4.16,4.31,4.31,0,0,1-5.21,1.79c.59.18,3,.53,5.24-4.08v0a8.24,8.24,0,0,1,2.52-5.32,13.54,13.54,0,0,0-1,10.29A1.76,1.76,0,0,0,19.8,83,11.36,11.36,0,0,1,19,78.77c0-8.55,9.66-15.51,21.54-15.51S62,70.22,62,78.77A11.36,11.36,0,0,1,61.2,83a1.76,1.76,0,0,0,1.34-.64,13.54,13.54,0,0,0-1-10.29A8.24,8.24,0,0,1,64.1,77.4v0c2.2,4.61,4.64,4.26,5.24,4.08a4.31,4.31,0,0,1-5.21-1.79,16.19,16.19,0,0,1-.88,4.16h2.32l-2.49,2H59.68a16.4,16.4,0,0,1-3.19,3.33c1.2-.11,2.57-.21,4-.22,1.07-.94,2.36-2,3.78-3.11h0l.18-.13c.74-.56,1.5-1.11,2.29-1.65l.26-.18h0a39.48,39.48,0,0,1,3.49-2.11,29.64,29.64,0,0,0,5.74-5.66h0l.06-.07.45-.64.15-.22A12,12,0,0,0,79,69.71,7.64,7.64,0,0,0,77.8,65c0,2.25.08,4.41.16,6.41a15.6,15.6,0,0,1-1.83,3.48C75.92,71,74.32,38,76,28.71a7.1,7.1,0,0,1-1.34-5.88,38.28,38.28,0,0,0,2.09-6.67s1.4-4.48,1.38-6.53L79.33,23.4l-.07.2a33.13,33.13,0,0,0-1.07,4.08,5.39,5.39,0,0,1-1.57-2c.22-.86.45-1.7.71-2.49l-.25-2.85c-.54,1.61-1.07,2.85-1.12,3a5.08,5.08,0,0,0,.42,3.36,6.23,6.23,0,0,0,1.55,2.24,12.31,12.31,0,0,0,2.2,1.87l.48.29-.17.53c-1.26,4.11-2.64,29.87-2.64,29.87,0,.39,0,.79,0,1.17a9.4,9.4,0,0,1,2.58,7.23,13.37,13.37,0,0,1-2.2,5.89c.07,1.38.15,2.64.23,3.76h.28c1.49-.12,2.79.71,2.16,1.75a2.46,2.46,0,0,1-1.72,1.15,2.58,2.58,0,0,0,.75-.85c.17-.3,0-.44-.14-.51l-.38,0h0a7.86,7.86,0,0,0-.84,0c.18,2.31.32,3.71.33,3.79L79,85.79H66.64c-1.46,1-2.84,2.15-4,3.15a11.85,11.85,0,0,1,7,2.12l-2.75,1.09h0a30,30,0,0,1-5.35,1.74h0l-.33,0L61,94c-9.66,1.67-10.67.75-10.67.75A10.09,10.09,0,0,0,57.11,92l.23-.24c.1-.1.62-.62,1.46-1.4-.62,0-1.22.07-1.81.12h0l-.44,0a8.82,8.82,0,0,0-1.18.23,7.12,7.12,0,0,0-.87.27l-.14,0a6.24,6.24,0,0,0-1,.44l-.11.07a5.63,5.63,0,0,0-.77.54l-.22.19a4.82,4.82,0,0,0-.75.86l-7.89.9.06,0a26.18,26.18,0,0,1-6.46,0l.06,0-7.89-.9a4.5,4.5,0,0,0-.76-.86l-.22-.2a7,7,0,0,0-.79-.55l-.09-.06a8.88,8.88,0,0,0-.95-.44L26.45,91c-.3-.11-.59-.2-.86-.27-.46-.11-.86-.17-1.14-.21l-.44,0h0c-.59,0-1.19-.09-1.81-.12.84.78,1.36,1.3,1.45,1.4l.24.24a10.09,10.09,0,0,0,6.78,2.71s-1,.92-10.67-.75l-.24,0-.33,0h0a29.76,29.76,0,0,1-5.35-1.74h0l-2.75-1.09a11.85,11.85,0,0,1,7-2.12c-1.2-1-2.58-2.1-4-3.15H2l.12-1.08c0-.08.15-1.48.33-3.79a7.86,7.86,0,0,0-.84,0h0l-.38,0c-.17.07-.31.21-.14.51a2.5,2.5,0,0,0,.74.85A2.47,2.47,0,0,1,.16,81.21c-.63-1,.67-1.87,2.16-1.75ZM76.78,49.11c.53-5.66,1.25-14.21,2.15-17.46a15.6,15.6,0,0,1-1.28-1,144.6,144.6,0,0,0-.87,18.5ZM74.63,80a11.89,11.89,0,0,1,1.8-.35c0-.46-.07-1-.1-1.48-.57.67-1.15,1.28-1.7,1.83Zm-5,3.82h7.17c-.06-.66-.15-1.61-.24-2.76a18.56,18.56,0,0,0-6.93,2.76ZM58.69,92.48l.07,0c1.06.59,4.54-.45,7.31-1.59a17.09,17.09,0,0,0-5.08-.6c-1.07,1-1.88,1.72-2.3,2.14ZM40.5,92.14c7,0,13-2.55,16.48-6.35.27-.3.53-.62.78-.94a.61.61,0,0,1,.07-.1,9.16,9.16,0,0,0,.61-.92,9.74,9.74,0,0,0,1.46-5.06c0-7.37-8.7-13.37-19.4-13.37s-19.4,6-19.4,13.37a9.83,9.83,0,0,0,1.45,5.06c.19.32.4.62.62.92l.08.1c.24.32.5.64.77.94,3.43,3.8,9.52,6.35,16.48,6.35ZM20,90.34a17.09,17.09,0,0,0-5.08.6c2.78,1.14,6.25,2.18,7.31,1.59l.07,0c-.42-.42-1.22-1.18-2.3-2.14ZM4.57,79.66a12.14,12.14,0,0,1,1.8.35c-.55-.55-1.13-1.16-1.7-1.83,0,.52-.07,1-.1,1.48Zm-.35,4.17h7.17a18.62,18.62,0,0,0-6.93-2.76c-.09,1.15-.18,2.1-.24,2.76Zm0-34.72a144.6,144.6,0,0,0-.87-18.5,15.6,15.6,0,0,1-1.28,1C3,34.9,3.68,43.45,4.22,49.11Z"></path></svg>`;
var armorClassBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 79 90" class="ddbc-svg ddbc-armor-class-box-svg "><path fill="#FEFEFE" d="M72.8,30.7v13.7c-1,3.6-9.7,30.9-31.9,38.6c-0.3-0.4-0.8-0.7-1.4-0.7c-0.6,0-1,0.3-1.4,0.7C26,78.7,17.9,68.6,12.9,59.8c0,0,0,0,0,0c-0.3-0.5-0.6-1-0.8-1.5c-3.6-6.7-5.4-12.4-5.9-14V30.7c0.7-0.3,1.2-0.9,1.2-1.7c0-0.1,0-0.2-0.1-0.3c6.2-4,8.5-11.5,9.2-15.2L38.1,7c0.3,0.4,0.8,0.7,1.4,0.7c0.6,0,1.1-0.3,1.4-0.7l21.4,6.6c0.8,3.6,3,11.1,9.2,15.2V29c0,0.2,0,0.4,0.1,0.6C71.8,30.1,72.3,30.5,72.8,30.7z"></path><path fill="#972e2e" d="M73.2,27.3c-0.4,0-0.8,0.2-1.1,0.4c-5.8-3.9-7.9-11.3-8.6-14.5l-0.1-0.4l-22-6.7c-0.1-0.9-0.8-1.7-1.8-1.7s-1.7,0.8-1.8,1.7l-22,6.7l-0.1,0.4c-0.6,3.2-2.7,10.6-8.6,14.5c-0.3-0.3-0.7-0.4-1.1-0.4c-1,0-1.8,0.8-1.8,1.9c0,0.8,0.5,1.5,1.2,1.7v13.5v0.2c0.9,3.2,9.7,31.2,32.4,39.2c0.1,1,0.8,1.8,1.8,1.8s1.8-0.8,1.8-1.8c9.3-3.3,17.3-10.1,23.8-20.4c5.3-8.4,7.9-16.5,8.6-18.8V30.9c0.7-0.3,1.2-0.9,1.2-1.7C75,28.1,74.2,27.3,73.2,27.3z M72.5,44.3c-1,3.6-9.6,30.5-31.5,38.2c-0.3-0.4-0.8-0.7-1.4-0.7c-0.6,0-1,0.3-1.4,0.7C16.3,74.8,7.8,47.9,6.7,44.3V30.9c0.7-0.3,1.2-0.9,1.2-1.7c0-0.1,0-0.2-0.1-0.3c6.1-4,8.4-11.4,9.1-15l21.3-6.5c0.3,0.4,0.8,0.7,1.4,0.7c0.6,0,1.1-0.3,1.4-0.7l21.2,6.5c0.8,3.6,3,11,9.1,15c0,0.1,0,0.2,0,0.3c0,0.8,0.5,1.5,1.2,1.7V44.3z M73.2,27.3c-0.4,0-0.8,0.2-1.1,0.4c-5.8-3.9-7.9-11.3-8.6-14.5l-0.1-0.4l-22-6.7c-0.1-0.9-0.8-1.7-1.8-1.7s-1.7,0.8-1.8,1.7l-22,6.7l-0.1,0.4c-0.6,3.2-2.7,10.6-8.6,14.5c-0.3-0.3-0.7-0.4-1.1-0.4c-1,0-1.8,0.8-1.8,1.9c0,0.8,0.5,1.5,1.2,1.7v13.5v0.2c0.9,3.2,9.7,31.2,32.4,39.2c0.1,1,0.8,1.8,1.8,1.8s1.8-0.8,1.8-1.8c9.3-3.3,17.3-10.1,23.8-20.4c5.3-8.4,7.9-16.5,8.6-18.8V30.9c0.7-0.3,1.2-0.9,1.2-1.7C75,28.1,74.2,27.3,73.2,27.3z M72.5,44.3c-1,3.6-9.6,30.5-31.5,38.2c-0.3-0.4-0.8-0.7-1.4-0.7c-0.6,0-1,0.3-1.4,0.7C16.3,74.8,7.8,47.9,6.7,44.3V30.9c0.7-0.3,1.2-0.9,1.2-1.7c0-0.1,0-0.2-0.1-0.3c6.1-4,8.4-11.4,9.1-15l21.3-6.5c0.3,0.4,0.8,0.7,1.4,0.7c0.6,0,1.1-0.3,1.4-0.7l21.2,6.5c0.8,3.6,3,11,9.1,15c0,0.1,0,0.2,0,0.3c0,0.8,0.5,1.5,1.2,1.7V44.3z M78.1,24.5c-8.7-1.8-9.9-14.9-9.9-15l-0.1-0.8L39.5,0L10.9,8.7l-0.1,0.8c0,0.1-1.2,13.3-9.9,15l-1,0.2v20.4v0.3C0,45.8,9.6,82.1,39.1,89.9l0.3,0.1l0.3-0.1C69.5,82.1,79,45.8,79.1,45.4V24.7L78.1,24.5z M76.7,45C76,47.5,66.6,80.1,39.5,87.5C12.6,80.1,3.2,47.4,2.5,45V26.7c8.3-2.4,10.3-13,10.7-16.1l26.4-8l26.4,8c0.4,3.1,2.4,13.7,10.7,16.1V45z M63.5,13.2l-0.1-0.4l-22-6.7c-0.1-0.9-0.8-1.7-1.8-1.7s-1.7,0.8-1.8,1.7l-22,6.7l-0.1,0.4c-0.6,3.2-2.7,10.6-8.6,14.5c-0.3-0.3-0.7-0.4-1.1-0.4c-1,0-1.8,0.8-1.8,1.9c0,0.8,0.5,1.5,1.2,1.7v13.5v0.2c0.9,3.2,9.7,31.2,32.4,39.2c0.1,1,0.8,1.8,1.8,1.8s1.8-0.8,1.8-1.8c9.3-3.3,17.3-10.1,23.8-20.4c5.3-8.4,7.9-16.5,8.6-18.8V30.9c0.7-0.3,1.2-0.9,1.2-1.7c0-1-0.8-1.9-1.8-1.9c-0.4,0-0.8,0.2-1.1,0.4C66.2,23.9,64.1,16.4,63.5,13.2z M72.5,30.9v13.5c-1,3.6-9.6,30.5-31.5,38.2c-0.3-0.4-0.8-0.7-1.4-0.7c-0.6,0-1,0.3-1.4,0.7C16.3,74.8,7.8,47.9,6.7,44.3V30.9c0.7-0.3,1.2-0.9,1.2-1.7c0-0.1,0-0.2-0.1-0.3c6.1-4,8.4-11.4,9.1-15l21.3-6.5c0.3,0.4,0.8,0.7,1.4,0.7c0.6,0,1.1-0.3,1.4-0.7l21.2,6.5c0.8,3.6,3,11,9.1,15c0,0.1,0,0.2,0,0.3C71.3,30,71.8,30.6,72.5,30.9z"></path></svg>`;
var initiativeBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 45" class="ddbc-svg ddbc-initiative-box-svg "><polygon fill="#FEFEFE" points="68.8,22.5 55.8,43.3 14.2,43.3 1.2,22.5 14.2,1.8 14.3,1.7 55.7,1.7 55.8,1.8 "></polygon><path fill="#972e2e" d="M59.1,0H10.9L0,17.2v10.5L10.9,45H59l11-17.2V17.2L59.1,0z M58.2,2.2l10,15.8v3L56.5,2.3l-0.1-0.1H58.2z M14.8,2.2h40.5l0.1,0.1L68,22.5L55.3,42.8H14.7L2,22.5L14.8,2.2L14.8,2.2z M1.8,18l10-15.8h1.8l-0.1,0.1L1.8,21V18z M11.8,42.8L1.8,27v-3l11.7,18.8H11.8z M68.2,27l-10,15.8h-1.7L68.2,24V27z"></path></svg>`;
var calloutBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 241 34" class="ddbc-svg ddbc-sense-row-box-svg ddbc-svg--empty"><g id="SenseRowBoxSvg-Page-1_1_"><g id="SenseRowBoxSvg-Sheet_Desktop_Static" transform="translate(-683.000000, -651.000000)"><path id="SenseRowBoxSvg-Page-1" fill="#d8d8d8" d="M692.1,651.2c-5.7,3.8-9.1,10-9.1,16.8s3.4,13,9.1,16.8l0.3,0.2h22.1l0.3-0.2c1.2-0.8,2.3-1.7,3.3-2.7h200.2l0.3-0.4c0.7-1.2,3-4.5,4.9-5.4l0.5-0.2l0-16.1l-0.5-0.2c-1.9-0.9-4.2-4.2-4.9-5.4l-0.3-0.4H718.1c-1-1-2.1-1.9-3.3-2.7l-0.3-0.2h-22.1L692.1,651.2z M685.5,668c0-5.8,2.9-11.2,7.6-14.5h10.3c4.7,2.1,11.1,3.2,14.3,3.8c2.3,3,3.7,6.8,3.7,10.7v0c0,3.9-1.3,7.7-3.7,10.7c-3.1,0.6-9.5,1.7-14.3,3.8h-10.3C688.4,679.2,685.5,673.8,685.5,668L685.5,668z M909.3,655.6c3.1,1.1,11.1,4.5,12.9,9.3l0,6.2c-1.9,4.8-9.9,8.2-12.9,9.3H729.9c-0.8-0.7-2.5-1.8-5.7-2.1c0.9-1.5,3-5.5,3-10.3s-2-8.8-3-10.3c3.2-0.3,4.9-1.4,5.7-2.1H909.3z M723.1,657.8c0.6,1,3.1,5.2,3.1,10.2s-2.5,9.2-3.1,10.2c-0.6,0-1.3,0-2,0c1.8-3.1,2.9-6.6,2.9-10.3v0c0-3.7-1-7.2-2.8-10.3C721.8,657.8,722.5,657.8,723.1,657.8L723.1,657.8z M713.8,682.5h-5.3c3.2-1.3,6-2.1,8.3-2.6C715.9,680.8,714.9,681.7,713.8,682.5L713.8,682.5z M720.5,679.3c3.9-0.4,6.3,0.4,7.7,1.1h-8.5C719.9,680,720.2,679.7,720.5,679.3L720.5,679.3z M917.4,680.4h-5.5c3.3-1.4,8.1-3.9,10.4-7.3v1.9C920.1,676.3,918.1,679.3,917.4,680.4L917.4,680.4z M922.2,661v1.9c-2.3-3.4-7.1-5.9-10.4-7.3h5.5C918.1,656.7,920.1,659.7,922.2,661L922.2,661z M728.1,655.6c-1.4,0.7-3.7,1.4-7.7,1.1c-0.3-0.4-0.5-0.7-0.8-1.1H728.1z M716.8,656.1c-2.4-0.5-5.1-1.3-8.3-2.6h5.3C714.9,654.3,715.9,655.2,716.8,656.1L716.8,656.1z"></path></g></g></svg>`;
var containerBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 281 200" class="ddbc-svg " preserveAspectRatio="none"><path fill="#FEFEFE" d="M274.78,153.59a27.53,27.53,0,0,0-.93-3c-1.71-4.27-1.13-39.26-1.13-39.26s0-12.67-.58-30.9c-.35-11.2,1.57-25,3.1-33.94a8.34,8.34,0,0,1-3-8.09,11.87,11.87,0,0,1,.79-2.54c0-1.16.12-2.31.26-3.46-.82-5.25-1.12-10.74-3.65-15.42S262.79,9.2,259,5.79c-.08-.08-.13-.15-.2-.23-2.22-1.06-4.61-1.79-6.78-3a6.15,6.15,0,0,1-.84-.57h-221c-.78.52-1.59,1-2.35,1.57A4.18,4.18,0,0,1,25,4.24c-6.23,5.4-13.07,9-15.73,17.58a46.94,46.94,0,0,0-1.78,9.43,3.2,3.2,0,0,1,.1.42c.27,1.51.42,3,.57,4.54,0,0,.13.91.13,1a14.6,14.6,0,0,0,.55,1.93,4.61,4.61,0,0,1-1.47,4.95,5.55,5.55,0,0,1-2.49,3c1.51,9,3.34,22.38,3,33.33-.58,18.23-.58,30.9-.58,30.9s.58,35-1.13,39.26a27.88,27.88,0,0,0-1.09,3.65,4.78,4.78,0,0,1,3,3.17c1.31,4,.41,8.33-.78,12.49A4.68,4.68,0,0,1,7.5,171C8.64,183.88,17.62,192.75,29,197.68A4.75,4.75,0,0,1,30.83,199h215.8c1.94-.54,3.91-1,5.81-1.65a3.83,3.83,0,0,1,1.31-.86,4.61,4.61,0,0,1,2.42-1.31l.75-.19a3.88,3.88,0,0,1,1.06-.81c1.25-.62,2.55-1.18,3.79-1.85a17.12,17.12,0,0,1,1.71-1.4,3.17,3.17,0,0,1,.65-.36c.08-.09.16-.17.23-.26s.57-.83.57-.83a5.39,5.39,0,0,1,2.46-2.06c.45-.55.88-1.12,1.29-1.69l.1-.12a37.3,37.3,0,0,0,4.72-17.11,3,3,0,0,1,0-.31c-1.65-3.32-1.28-6.59-1.53-10.19A4.68,4.68,0,0,1,274.78,153.59Z"></path><path fill="#972e2e" d="M275.28,101.4v2c.77-12.53,2.64-42.67,5.52-52l.21-.68-.6-.37a20.9,20.9,0,0,1-3.68-3.08,60.93,60.93,0,0,1,2.34-9.38l.12-.34L276.7,10l-1.08-.34c-2.52-.78-9.71-3.91-9.71-8V0H15.09V1.68c0,4.05-7,7.12-9.71,8L4.3,10,1.82,37.56l.12.34a61.53,61.53,0,0,1,2.34,9.36A21.05,21.05,0,0,1,.6,50.36l-.6.38.21.67c2.88,9.33,4.74,39.41,5.51,52v-2C5,113.87,3.09,139.25.21,148.59l-.21.68.6.37a20.9,20.9,0,0,1,3.68,3.08,59.8,59.8,0,0,1-2.34,9.38l-.12.34L4.3,190l1.08.34c2.7.84,9.71,3.91,9.71,8V200H265.91v-1.68c0-4,7-7.12,9.71-8l1.08-.34,2.48-27.58-.12-.34a61.53,61.53,0,0,1-2.34-9.36,21.05,21.05,0,0,1,3.68-3.1l.6-.38-.21-.67c-2.88-9.33-4.74-34.65-5.51-47.19m-3.84,62.1s.45,1.05,1,2.57a28.69,28.69,0,0,1-1.33,12.18c-2.95,8.6-10.16,14.89-20.88,18.39H30.68c-23-7.48-22.8-25.21-22.16-30.51.59-1.59,1.06-2.7,1.09-2.78a11.79,11.79,0,0,0-2.1-9.57c3.38-18.48,1.66-42,1.58-43.08V89.42c.09-1.17,1.81-24.74-1.57-43.23A12,12,0,0,0,9.56,36.5s-.45-1.06-1-2.57A28.69,28.69,0,0,1,9.87,21.75c3-8.6,10.16-14.9,20.89-18.39H250.32c23.05,7.48,22.8,25.21,22.16,30.51-.59,1.59-1.06,2.7-1.09,2.78a11.79,11.79,0,0,0,2.1,9.57c-3.38,18.48-1.66,42-1.58,43.08v21.28c-.09,1.17-1.81,24.74,1.57,43.23a12,12,0,0,0-2.05,9.69m7.41-112c-1.71,6-3,17.24-4,27.91a184.33,184.33,0,0,1,1.5-29.93,24.77,24.77,0,0,0,2.5,2m-5.72-14.31c.09-.2,1.13-2.66,2.12-5.71l.51,5.64A58.68,58.68,0,0,0,274,43.57a9.17,9.17,0,0,1-.89-6.35m.42-24.74,1.24,13.81c-.25,1.19-.59,2.43-1,3.62a29,29,0,0,0-1.55-8.55c-2-5.88-6.88-13.33-18.42-18h8.89c1.25,5.13,8,8.1,10.8,9.12M18.25,3.36h8.88C10.49,10.1,7.46,22.74,7.21,30c-.38-1.23-.74-2.52-1-3.75L7.45,12.48c2.79-1,9.55-4,10.8-9.12m-13,33.79.51-5.64c1,3,2,5.43,2.07,5.56A9.4,9.4,0,0,1,7,43.51a59.87,59.87,0,0,0-1.73-6.36M4.64,49.5A184.34,184.34,0,0,1,6.15,79.44c-1-10.67-2.29-21.88-4-27.91a22.88,22.88,0,0,0,2.49-2m-2.49,99c1.71-6,3-17.24,4-27.91a184.33,184.33,0,0,1-1.5,29.93,23.42,23.42,0,0,0-2.5-2m5.72,14.31c-.09.2-1.13,2.66-2.12,5.71l-.51-5.63A59.49,59.49,0,0,0,7,156.43a9.17,9.17,0,0,1,.89,6.35m-.42,24.74L6.21,173.71c.25-1.18.59-2.42,1-3.62a29,29,0,0,0,1.55,8.55c2,5.89,6.88,13.33,18.42,18H18.25c-1.25-5.13-8-8.1-10.8-9.12m255.3,9.12h-8.88c16.64-6.73,19.67-19.38,19.92-26.68.38,1.23.74,2.52,1,3.75l-1.24,13.81c-2.79,1-9.55,4-10.8,9.12m13-33.78-.51,5.63c-1-3-2-5.43-2.07-5.56a9.41,9.41,0,0,1,.85-6.44,60.72,60.72,0,0,0,1.73,6.37m.6-12.36a184.34,184.34,0,0,1-1.51-29.94c1,10.67,2.29,21.88,4,27.91a22.88,22.88,0,0,0-2.49,2"></path></svg>`;
var groupsBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 278 338" class="ddbc-svg " preserveAspectRatio="none"><polygon fill="#FEFEFE" points="8 336 271 336 271 2 8 2 8 336"></polygon><path fill="#972e2e" d="M278,6.39V4.47h-6.14V0h-2.68s-1.06,1.54-3.91,1.54H12.73C9.88,1.54,8.82,0,8.82,0H6.14V4.47H0V6.39c2.53,0,2.67,4.14,2.67,4.14V324.91S2.53,329,0,329V331H6.14v7H8.82V3.31H269.18V334.69H8.82V338s1.06-1.54,3.91-1.54H265.27c2.84,0,3.9,1.52,3.91,1.54h2.68v-7H278V329c-2.53,0-2.67-4.13-2.67-4.13V10.53s.14-4.14,2.67-4.14ZM6.27,324.91H4.14V12.12H6.27Zm267.79.48h-2.12V12.61h2.12Z"></path></svg>`;
var otherBoxSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 94 89" class="ddbc-svg " preserveAspectRatio="none"><path fill="#FEFEFE" d="M87.54,9.45a42.28,42.28,0,0,1-3-3A42.91,42.91,0,0,0,74.21,1H18.36a11,11,0,0,0-1.53.59A4.9,4.9,0,0,1,15.36,2.7,21.09,21.09,0,0,0,6,12.28a5.14,5.14,0,0,1,.12,1.59,5.15,5.15,0,0,1,.24,1.18c1,12.72.57,25.84.4,38.59-.09,6.5,0,13-.05,19.48,0,2-.11,4.08-.22,6.12a17.93,17.93,0,0,0,2.78,2.94A73.22,73.22,0,0,0,16.51,87H78l.07-.06a32.31,32.31,0,0,0,9.31-8.5c.13-6,.65-12,.36-18s.2-11.89.36-17.9c.16-6.53,0-13.11-.17-19.64C87.84,18.57,88.07,13.86,87.54,9.45Z"></path><path fill="#972e2e" d="M85,0H9L0,9.05V80l9,9H85l9-9V9.05Zm6.55,10.08v7a29.26,29.26,0,0,0-3.24-6.78v-.13h-.08a20.45,20.45,0,0,0-9.13-7.69H84ZM75.6,86.52H18.36a19,19,0,0,1-11.3-7.73V10.25A19.27,19.27,0,0,1,18.4,2.48H75.64a18.94,18.94,0,0,1,11.3,7.73V78.75A19.27,19.27,0,0,1,75.6,86.52ZM2.47,21.18a31.7,31.7,0,0,1,3.24-8.8V76.64c-.3-.53-.62-1-.89-1.62a32.92,32.92,0,0,1-2.35-7.11Zm85.82-8.82c.3.53.62,1,.89,1.62a32.92,32.92,0,0,1,2.35,7.11V67.81a31.64,31.64,0,0,1-3.24,8.81ZM10.05,2.48h4.87a20.45,20.45,0,0,0-9.13,7.69H5.71v.13a29.26,29.26,0,0,0-3.24,6.78v-7ZM2.47,78.92v-7A29.45,29.45,0,0,0,5.71,78.7v.13h.08a20.45,20.45,0,0,0,9.13,7.69H10.05ZM84,86.52H79.08a20.45,20.45,0,0,0,9.13-7.69h.08V78.7a29.45,29.45,0,0,0,3.24-6.78v7Z"></path></svg>`;
var expandArrowSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="ddbc-svg ddbc-svg--light"><path fill="#fff" d="M11,2.48,5,8l6,5.52a1.3,1.3,0,0,1-.21,2.12h0a2.25,2.25,0,0,1-2.68-.17L0,8,8.11.53A2.25,2.25,0,0,1,10.79.36h0A1.3,1.3,0,0,1,11,2.48Z"></path><polygon fill="#fff" points="6.92 8 16 0 16 16 6.92 8"></polygon></svg>`;
var abilitySVGs = {
str: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35.11 37.7" class="ddbc-svg gs-ability-svg"><title>Strength</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-a" d="M22.23,9.42a7.43,7.43,0,0,1,.24,4.07c4.91.71,6.94,4.19,7.33,6.13l.31,1.54-1.54.31a13.16,13.16,0,0,1-2.62.27h0a11.71,11.71,0,0,1-1.86-.15l.76,1.1a8.79,8.79,0,0,1,.2,9,8.83,8.83,0,0,1-1,1.46C28.5,34.87,27,37.7,31,37.7s6.91-24.39,0-27.49C29.34,9.27,24.62,9.18,22.23,9.42Z"/><path class="cls-a" d="M8.34,12.46l3.4-2.82C8.38,9.27.45,1.55.7,1.91,1.78,7.79,8.34,12.46,8.34,12.46Z"/><path class="cls-a" d="M28.47,19.93s-1.05-5.21-8.05-5c0,0,2.73-4.68-2.25-9.32C13,.82,3.57,0,3.57,0S16.34,6.63,14.9,11.22c0,0-6.06,2.36-6.73,5.78s-1.41,5.12-6.36,8.32c0,0-2,1.88-1.79,2.89s5.12,6.7,7.48,6.52,7.7-1.79,11.73-.88,7.35-6.26,4.55-10.24a34.73,34.73,0,0,1-3.37-5.38S23.3,21,28.47,19.93Z"/><path class="cls-b" d="M10.52,21.8a6.75,6.75,0,0,1,5.53-5s-1.81.95-1.87,1.36,1,1.45-.26,2.73C12.38,22.39,11.17,19.78,10.52,21.8Z"/></g></g></svg>`,
dex: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.17 35.63" class="ddbc-svg gs-ability-svg"><title>Dexterity</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-b" d="M13,20s1-5.61,7.7-7c0,0-2.52,1.32-2.6,1.9s1.43,2-.36,3.8C15.62,20.79,14,17.16,13,20Z"/><path class="cls-b" d="M15.68,30.39c.06,0,.55.05,1.28.07L15.71,30Z"/><path class="cls-a" d="M10.45,6.26A7.07,7.07,0,0,0,6,2.16L7.06,7.39Z"/><path class="cls-a cls-e cls-j cls-h" d="M9.49,26.36a15.46,15.46,0,0,1-1.48,9"/><path class="cls-a cls-e cls-j cls-i" d="M11.67,27.58S14,30.79,13,34.15"/><path class="cls-a cls-e cls-j cls-i" d="M5.32,28.82a6.15,6.15,0,0,1-1.45,5.33"/><path class="cls-a" d="M10.06,18.91a6,6,0,0,1-3.69,1.7A1.73,1.73,0,0,1,5,20.09c-.9-1-.12-3.19,1.76-4.86a6,6,0,0,1,3.69-1.7,1.73,1.73,0,0,1,1.34.52C12.72,15.06,11.94,17.24,10.06,18.91Z"/><path class="cls-a" d="M10.48,14.48a5.24,5.24,0,0,0-3.06,1.46C5.8,17.38,5.34,19,5.74,19.46a.87.87,0,0,0,.63.2A5.24,5.24,0,0,0,9.43,18.2a6,6,0,0,0,1.66-2.29,1.35,1.35,0,0,0,0-1.23A.87.87,0,0,0,10.48,14.48Z"/><path class="cls-a" d="M21.39,23.19h.12l.54,0h.2l.43,0,.17,0,.52-.06h.07l.37-.06.12,0,.2,0h.07l.08,0a4.69,4.69,0,0,0-1.47-1.67A9.68,9.68,0,0,1,24,21l.42,0c.3,0,.6-.06.93-.06s.57,0,.86,0l.45,0a14.14,14.14,0,0,1,1.48.22c-.06-.27-.13-.6-.21-1l-.14-.58-.13-.55c-.07-.3-.15-.6-.24-.93l-.07-.27a44.12,44.12,0,0,0-1.88-5.52l0-.09c-.21-.48-.42-1-.65-1.43h0a21.2,21.2,0,0,0-1.76-3H21.74A16.87,16.87,0,0,0,12.81,0V7.39s-9.14,3.49-9.34,6.16-.41,6.26-1,6.88-3,3.75-2.34,4.36,4.6,5.08,6.76,5.08,7.19-.51,8.42,0l.44.16L15.83,29s.51,0,1.25.05h.14c.33,0,.72,0,1.13,0l.32,0,1-.11.48-.07c.35-.06.71-.13,1.07-.21l.49-.11A13,13,0,0,0,23.33,28a12.19,12.19,0,0,1-3.67-2.79l.6.07.18,0,.39,0h1.6a5.59,5.59,0,0,1-2.34-2.23,6.62,6.62,0,0,0,1.28.11Z"/><path class="cls-b" d="M10.15,16.32A3.88,3.88,0,0,1,9.07,17.8a3.38,3.38,0,0,1-2,.94.56.56,0,0,1-.41-.13c-.26-.29,0-1.35,1.08-2.27a3.38,3.38,0,0,1,2-.94.56.56,0,0,1,.41.13A.87.87,0,0,1,10.15,16.32Z"/><path class="cls-a" d="M35.1,21.8c0-.13,0-.25,0-.39a8.32,8.32,0,0,0-1.85-4.57,7.41,7.41,0,0,1,2.07,1.36c-1.38-3.91-4.48-4-4.8-4a25.72,25.72,0,0,0-3.73-2.4,49.22,49.22,0,0,1,2.93,9.45l.29,1.4-1.4-.28a12.45,12.45,0,0,0-2.45-.26l-.72,0a4.55,4.55,0,0,1,.37.63l.53,1.1-1.2.24a18.83,18.83,0,0,1-2.24.28,2.09,2.09,0,0,0,.53.31l4.25,1.58-4.53.25H23a8.52,8.52,0,0,0,1.41.83l2,.91-2,.83a17.27,17.27,0,0,1-6.11,1.14c2,2.75,8.06,5.4,8.06,5.4-.46-2.55,2.55-4.51,2.55-4.51.89.27,1,4.51,1,4.51a19.44,19.44,0,0,0,4.61-7.81A7.25,7.25,0,0,1,36,30.17C36.53,28.15,35.8,24.49,35.1,21.8Z"/><path class="cls-b" d="M6.12,19.45a6.75,6.75,0,0,1,5.53-5s-1.81.95-1.87,1.36,1,1.45-.26,2.73C8,20,6.77,17.44,6.12,19.45Z"/></g></g></svg>`,
con: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34.76 32.85" class="ddbc-svg gs-ability-svg"><title>Constitution</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><g id="Ea1JOO.tif"><path class="cls-a" d="M2.41,13.25l2.89.47.78,3.08h.49l.42-3,3,2.14c-2.7,2.42-3.43,5.23-2.15,8.8L6.19,24v1.82c-.39.06-2.22-.09-2.51,0a2.42,2.42,0,0,1-.14-.25C3,23.88,5.79,22.94,6,21.51a5.19,5.19,0,0,0-2.06-5.13c-.62-.47-1.18-.86-.91-1.91.08-.33-.36-.83-.56-1.26Z"/><path class="cls-a" d="M20.71,1.89c-2,.29-6.66,1.53-9.16,1.89C12.87,2.57,16,.08,17.63,0,18.55,0,20,1.08,21,1.45Z"/><path class="cls-a" d="M26.3,7.44l.56-2-.23-.12-2.25,4,3.13-1.39Z"/><path class="cls-a" d="M12.66,8.84c-.7.06-1.52,2.65-2.25,3.78,1.88-.11,4.25.1,6,0C15.41,11.26,15.11,8.61,12.66,8.84Z"/><path class="cls-a" d="M5.49,6.6c-.12-.53-.73-.88-1.25-1.16a4.15,4.15,0,0,0-.73-.32l-.22,0A2.35,2.35,0,0,0,2.85,5a1.8,1.8,0,0,0-.5,0l-.07,0a1.8,1.8,0,0,0-.41.19l-.13.09a2.54,2.54,0,0,0-.36.31l-.09.09a4.31,4.31,0,0,0-.41.56l-.1.17q-.15.26-.3.58l-.11.23c-.13.28-.25.58-.37.92l.33.09h0l.35.11L1,8.5h.05l.3,0h.17l.07,0,.09,0,.07,0,.08-.06.06-.06L2,8.25l0-.08L2.08,8l0-.1c0-.05,0-.11,0-.18s0-.08,0-.12,0-.16,0-.25,0-.08,0-.13,0-.29,0-.46c.51.4.72.7.95.72l.73.07c.23,0,.46,0,.66,0H4.7a1.61,1.61,0,0,0,.32,0l.05,0a.43.43,0,0,0,.25-.16A1,1,0,0,0,5.49,6.6Z"/><path class="cls-a" d="M6.08,16.09l-.26-2.26C6.74,14.1,6.77,14.34,6.08,16.09Z"/></g><path class="cls-a" d="M34.76,16.27c-1.1-3-1.6-6.19-4.52-7.61-2,2.38-2.26,2.51-4.05,2.05.32-.11.65-.19,1-.32A3.53,3.53,0,0,0,29.6,7.64a4.31,4.31,0,0,0-1.14-3.92,1.91,1.91,0,0,0-2.72-.29c-.69.47-1.39.9-2.1,1.34A.57.57,0,0,1,23.3,5c-.16.1-.76-.88-1.71-.94a18.17,18.17,0,0,0-5.81.46A45.59,45.59,0,0,1,8.81,6a4.8,4.8,0,0,0-.86.17s0,.07.05.11a2.29,2.29,0,0,1-.35,1.83L8.18,8l.06.32L.35,10.83l1.06,3.1,1-.68c-.25-.66.15-.53.49-.48,1.29.21,2.57.46,3.86.64,2.56.35,3.86,2.18,4.58,4.69.64,2.2-.29,3.83-1.64,5.3l-.24.28c-.54,3-2.29,4-4.93,3.58a3.79,3.79,0,0,0,3.93.89A29.55,29.55,0,0,1,11.88,27c2.17-.51,4.42-1.28,6.56-.31,1.55.71,2.83,2.08,4.29,3.06s3.16,2.13,4.8,3c.31-.85.59-1.71.83-2.59.35-1.27,1-2.47,1.28-3.75a.5.5,0,0,1,.57-.44l1-2,.59,2.31a11.8,11.8,0,0,0,.7-1.72,49.17,49.17,0,0,0,1.24-6.29,14.3,14.3,0,0,0-.66-3.8ZM11.12,12.18c.55-.87,1.18-2.84,1.72-2.89,1.87-.17,2.1,1.85,2.86,2.89C14.37,12.25,12.56,12.1,11.12,12.18Z"/></g></g></svg>`,
int: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.86 31.19" class="ddbc-svg gs-ability-svg"><title>Intelligence</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-a" d="M5.25,6.93a8.88,8.88,0,0,1,.49-.79,4.36,4.36,0,0,1,.63-.66,7.76,7.76,0,0,1,1.74-.89C4.42,2.69,1.84.88,2.35,2.56c.29.95.21,1.09,2,3.38Z"/><path class="cls-a" d="M23,8v.06C23,8.08,23,8,23,8Z"/><path class="cls-a" d="M5.82,8.83A31.34,31.34,0,0,1,21.34,7.16c-.86-.48-2.2-1.25-4.28-2.49C10.47.74,5.81-1.23,7.18.82A11.26,11.26,0,0,1,9.35,6S6.56,7,5.82,8.83Z"/><g id="QFqb7d.tif"><path class="cls-a" d="M22.92,9.39c-.3-.35-.56-.75-.87-1.16.2,0,.34,0,.48,0a.54.54,0,0,0,.18-.08.65.65,0,0,0-.08-.2c-.29-.31-.57-.62-.87-.91a18.35,18.35,0,0,0-4.95-3.29,9.6,9.6,0,0,0-3.79-1c-.31.16-.61.34-.93.48s-.88.56-1.35.81-1.14.66-1.7,1c-.14.11-.3.2-.44.3.1.22-.05.43-.23.63Q7.3,7.18,6.27,8.4a4.12,4.12,0,0,0-1,3.39,4.22,4.22,0,0,1-.73,3,10.25,10.25,0,0,1-1.91,2.12c-.8.69-1.62,1.35-2.42,2-.26.22-.26.29,0,.53a4.52,4.52,0,0,0,2,1.1,1,1,0,0,0,.37,0c.18,0,.38-.2.49.12,0,0,.12.06.18.05a9.94,9.94,0,0,0,1.69-.17c1.23-.32,2.44-.71,3.65-1.09A11.76,11.76,0,0,1,12,18.66c.62,0,.62,0,.84.67.32,1,1.7,1.82,1.48,2.8,0,.08,0,.15-.06.23a4.42,4.42,0,0,1,.53,3.24,5.41,5.41,0,0,1-1.51,3.61c-.09.21-.17.42-.27.61a3.89,3.89,0,0,1-.53.76.28.28,0,0,0,.15.08c1.74-.77,4.27-3.57,5.64-5.13.46-.52.77-.14.41.49-.68,1.18-2.08,4.1-3,4.91q1.85.13,3.71.2l1.79.06.37-.06c.55-.11,1.09-.26,1.63-.42.89-.79,2.16-4,2.65-4.94.39-.72.55-.09.62.72.13,1.4-1.72,3.5-2.06,4a20.7,20.7,0,0,0,4.31-2c3.19-2.79,1.84-6.61,1-8.11-.34-.63-1.47-3.09-1.54-3.42a18.82,18.82,0,0,1,2.63,4.73C30.84,14.15,23.88,10.5,22.92,9.39Z"/></g><polygon class="cls-b" points="8.11 11.41 8.04 11.11 8.84 9.73 10.49 9.73 10.04 10.94 8.4 11.73 8.11 11.41"/><path class="cls-b" d="M13.17,28.75a8.88,8.88,0,0,0,1.14-3.16v-.07l0-.07a4,4,0,0,0-.51-2.88l-.07-.16.1-.39c.08-.34-.28-.78-.65-1.24a4.27,4.27,0,0,1-.82-1.29c0-.12-.08-.24-.11-.32H12a11.27,11.27,0,0,0-3.28.7c-1.21.39-2.44.78-3.68,1.1a6.2,6.2,0,0,1-1.29.15l-.48,0h0A.77.77,0,0,1,2.71,21H2.66a1.72,1.72,0,0,1-.38.06H2.22l-.13,0-.19-.07-.49-.14.13-.5.14-.44.1-.09c.1-.09,2.42-2.23,3.75-3.19s5-3,7.73-3a4.52,4.52,0,0,1,1.12.13,6.86,6.86,0,0,1,3.86,3.62,9.52,9.52,0,0,1,.31,7.95l-.1.25-.27.05c-1.75,2-3.41,3.77-4.5,3.93l-1,.15Z"/><path class="cls-a" d="M13.26,14.06a4,4,0,0,1,1,.12c2.52.64,6,5.42,3.82,10.89a.5.5,0,0,0-.29.16c-1.37,1.55-3.22,3.62-4.18,3.76a9.62,9.62,0,0,0,1.21-3.4,4.42,4.42,0,0,0-.53-3.24c0-.08,0-.15.06-.23.22-1-1.16-1.83-1.48-2.8-.2-.61-.22-.67-.7-.67H12a11.76,11.76,0,0,0-3.43.73c-1.21.39-2.42.77-3.65,1.09a9.94,9.94,0,0,1-1.69.17h0c-.06,0-.15,0-.16-.05s-.13-.2-.21-.2a1.93,1.93,0,0,0-.29.07,1.79,1.79,0,0,1-.29,0H2.2L2,20.45l.1-.31s2.39-2.2,3.7-3.16c1.16-.84,4.77-2.92,7.44-2.92m0-1c-3.06,0-6.91,2.3-8,3.11-1.34,1-3.69,3.14-3.79,3.23l-.2.18-.08.26-.1.31-.3,1,.94.28.26.09a1.32,1.32,0,0,0,.32,0,1.63,1.63,0,0,0,.31,0,1.27,1.27,0,0,0,.63.16h.11l.46,0a6.69,6.69,0,0,0,1.39-.17c1.25-.33,2.49-.72,3.7-1.1a11.39,11.39,0,0,1,3-.68,4.79,4.79,0,0,0,.9,1.43,2.94,2.94,0,0,1,.55.82l0,.07,0,.13-.08.34.14.31a3.59,3.59,0,0,1,.49,2.51l0,.14v.15a8.31,8.31,0,0,1-1.07,2.93l-1,1.78,2-.3c1.13-.17,2.47-1.47,4.68-4l.38-.08.2-.5a10,10,0,0,0-.33-8.36,7.27,7.27,0,0,0-4.18-3.88,5,5,0,0,0-1.25-.15Z"/></g></g></svg>`,
wis: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.04 31.68" class="ddbc-svg gs-ability-svg"><title>Wisdom</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-a" d="M14.46,4.32S21.57-1.33,30,3A9.07,9.07,0,0,0,27,3.41a4.45,4.45,0,0,1,1.19,0,3.17,3.17,0,0,1-2,.4s0,.23.89.28a3.66,3.66,0,0,1-2.46.58,2.62,2.62,0,0,0,1.16.25s-.54.62-2.23.56a.68.68,0,0,0,.41.18,2.45,2.45,0,0,1-1.47.16A.92.92,0,0,0,23,6.1s-1.85.3-2.39,1S14.46,4.32,14.46,4.32Z"/><path class="cls-a" d="M5.91,5.48s4-6,10.7-5.45a6.45,6.45,0,0,0-1.9,1.1,3.16,3.16,0,0,1,.78-.32,2.25,2.25,0,0,1-1.18.79s0,.16.66-.06c0,0-.25.56-1.46,1a1.86,1.86,0,0,0,.83-.15s-.18.55-1.31,1a.48.48,0,0,0,.32,0,1.74,1.74,0,0,1-.92.5.66.66,0,0,0,.43,0s-1.13.7-1.3,1.3S5.91,5.48,5.91,5.48Z"/><path class="cls-a" d="M3.34,12.44l-.45-.2C2.37,7.72,5,3.3,11.74,3.3a16.36,16.36,0,0,1,2.72.22A7.54,7.54,0,0,0,10.73,8.4c-1.26,4.8-3.78,4.81-5.86,5.14A4.65,4.65,0,0,0,3.34,12.44Z"/><path class="cls-a" d="M3.77,14.8"/><path class="cls-a" d="M19.44,15.72l.57-.34a3.35,3.35,0,0,0-.33-.85l.53-.38a4.61,4.61,0,0,0-.74-1l-2-1.84,1.26.66.27-.55.13.06a3.42,3.42,0,0,0,.52.15c-.59-.53-1-.86-1-.86L17.23,9.7l1.48.42a56.1,56.1,0,0,0-5.25-2.37l.11-.31a6.85,6.85,0,0,0-1.1,2.38,10,10,0,0,1-.57,1.63,1.61,1.61,0,0,1,.18,0c1,0,2.79.83,2.79,1.84S13.52,16,12.54,16a2.9,2.9,0,0,1-2.3-1.8c-1,1-3.12.75-4.06.89a3.2,3.2,0,0,1,.17,2.62l.55.5L6,18.44l.16.29,0,0s5.51,2.65,8.77,2.28,4.18-3.59,4.22-3.73l.24-.78.39.72a5.17,5.17,0,0,0,.68.92A19.09,19.09,0,0,0,19.44,15.72Z"/><path class="cls-a" d="M3.51,15.49a3.83,3.83,0,0,0-1.83-1.95A3.83,3.83,0,0,1,3.51,15.49Z"/><path class="cls-a" d="M4.45,18.36a9,9,0,0,0-.76-3.09A4.36,4.36,0,0,0,1.6,13S-1.56,17.25,1,21.32a5.34,5.34,0,0,1,.91-.45A3.41,3.41,0,0,1,4.45,18.36Z"/><path class="cls-a" d="M1.67,21.54A6.29,6.29,0,0,1,2,20.43a4.7,4.7,0,0,0-.8.39A6.63,6.63,0,0,0,1.67,21.54Z"/><path class="cls-a" d="M29,22.84a2.13,2.13,0,0,1,.88.88S29.44,19.65,27,18a2.46,2.46,0,0,1,1.86.85s-.28-2.26-1.75-3a3.71,3.71,0,0,1,1.47.31,5.25,5.25,0,0,0-2.77-3.42,3.11,3.11,0,0,1,1.19.28s-.37-2.2-3.5-3.53A3.65,3.65,0,0,1,25,9.69l-1-.71A15.15,15.15,0,0,0,15,4a7.63,7.63,0,0,0-2.11,1.71c1.16.45,7.4,2.89,8.62,4.33l.86,1-1.74-.48.84.78.88.84-1.2-.12a2.07,2.07,0,0,1,.25.3l.45.66L21,13H21a9.43,9.43,0,0,1,1.09,2l.4,1-1-.46-.27-.14a6.46,6.46,0,0,1,.15.94l.06.75L21.15,17a13,13,0,0,1,.94,2.93L22.25,21l-.84-.7a12.24,12.24,0,0,1-1.6-1.64,7,7,0,0,1-5.52,4.22,8.15,8.15,0,0,1-.89,0c-3.28,0-7-1.76-8.4-2.52a4.32,4.32,0,0,0-1.62-.25,4.75,4.75,0,0,0-.53,1.53l-.33,2.76v0a16,16,0,0,0,2,4.79,5.4,5.4,0,0,0,2,2,4.58,4.58,0,0,1-.69-2.16A7.65,7.65,0,0,0,11,31.68a3.22,3.22,0,0,1-.23-2.7,4.71,4.71,0,0,0,3,2.56,3,3,0,0,0,.63-2.73c1.77,2.76,6.62,2.86,6.62,2.86a4.12,4.12,0,0,1-.43-3.26c.8,2.16,4.13,2.83,4.13,2.83a3.47,3.47,0,0,1-.43-2.3A3.38,3.38,0,0,0,27,30.24c-.92-1-1.33-3.5-1.33-3.5a6.56,6.56,0,0,1,2.26,4.93,3.3,3.3,0,0,0,2-2.15h0a2.3,2.3,0,0,0,.07-.46h0A11.7,11.7,0,0,0,29,22.84Z"/></g></g></svg>`,
cha: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36.89 29.81" class="ddbc-svg gs-ability-svg"><title>Charisma</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-b" d="M11.26,9.5a12.63,12.63,0,0,0-3.6,2.44,2.06,2.06,0,0,0,2,1.75,2.8,2.8,0,0,0,2.49-2.45A2.13,2.13,0,0,0,11.26,9.5Z"/><path class="cls-a" d="M35.18,29.31a10.94,10.94,0,0,0,.08-4.38,4.24,4.24,0,0,0,1.63,2,17.82,17.82,0,0,1-2.07-8.2s.61,1.65,1.38,3.59c0,0,.32-1.84-1.16-6.76a37.09,37.09,0,0,1,1.52,4.55s-.1-11.94-5.1-14.83c0,0,1.22-.14,4.63,4.39,0,0-2.57-6.19-7.76-7.91l4.51,1.34S29.87.47,22.11.59c0,0,3.38-.37,4.08-.05,0,0-9.76-2.63-16.74,3.72,0,0-2.32.08-3,.73,0,0-2.36-.48-5,2.14-3.13,3.07-.29,6.57,1.25,8a3.78,3.78,0,0,1,.42-2.87s2,1.31,6.06,1c11.25-.74,8,4,4.39,7.46,0,0-1.87,1.75-5.54,5.58,0,0,5.56-1.68,6.42-2.75a10.86,10.86,0,0,1,1.78,3.57,8.09,8.09,0,0,0,1.72-3,9.1,9.1,0,0,0,.42,2.11,2.47,2.47,0,0,0,.94-1,4.83,4.83,0,0,0,.68,1.54,3.46,3.46,0,0,0,.55-1.54,6.4,6.4,0,0,0,1.82,3.36,3.52,3.52,0,0,0,.55-1.8,2.35,2.35,0,0,0,.73,1,11.67,11.67,0,0,0,.83-4.24s.47,4.32,2.08,5.81a5.41,5.41,0,0,0,.63-2.68,39.45,39.45,0,0,0,4.36,3.15,5.51,5.51,0,0,1-.7-2.45S30.75,27.56,35.18,29.31Z"/><path class="cls-b" d="M16.29,4.95c0,1,1.6,1.75,2.56,1.75a1.74,1.74,0,0,0,1.4-2.79,21.32,21.32,0,0,0-3.77.49A1,1,0,0,0,16.29,4.95Z"/><path class="cls-a cls-d cls-j" d="M9.37,15.38a6.18,6.18,0,0,1,5.37-2.71c3.83,0,1.17-1.87-2.33-2.54s-.33-5.67-8-7"/><path class="cls-a cls-d cls-j" d="M3.66,13.55S.73,11,3.5,10.66c1.19-.12,10.25,0,10.25,0"/></g></g></svg>`
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// HTML Structures
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//base html for the controls
var controlsHTML = `
<div id="gs-campaign" class="gs-campaign gs-box-grey gs-box-bluetop">
<div class="gs-title gs-header-campaign">Campaign</div>
<div class="gs-container gs-col-container">
<div class="gs-campaign-row1 gs-container gs-row-container">
<div class="gs-controls gs-container gs-col-container">
<div class="gs-header gs-header-controls">Controls</div>
<div class="gs-container gs-row-container">
<div class="gs-auto-update-controls gs-container gs-col-container">
<div class="gs-subheader gs-header-auto-update-controls">Auto Update</div>
<div class="gs-form-group gs-container gs-col-container">
<div class="gs-form-field gs-row-container">
<label for="gs-auto-update"><span>Enabled</span></label>
<input type="checkbox" name="gs-auto-update" id="gs-auto-update" value="false">
</div>
<div class="gs-form-field gs-form-field-number gs-row-container">
<label for="gs-auto-duration"><span>Duration (s)</span></label>
<input type="number" name="gs-auto-duration" id="gs-auto-duration" value="60" placeholder="Duration (secs)">
</div>
</div>
</div>
</div>
</div>
<div class="gs-views gs-container gs-col-container">
<div class="gs-header gs-header-controls">Visible Sections</div>
<div class="gs-container gs-row-container">
<div class="gs-view-controls gs-container gs-col-container">
<div class="gs-auto-update-controls gs-container gs-col-container">
<div class="gs-form-field gs-row-container">
<label for="gs-show-abilities"><span>Abilities</span></label>
<input type="checkbox" name="gs-show-abilities" id="gs-show-abilities" value="false">
</div>
<div class="gs-form-field gs-row-container">
<label for="gs-show-saving-throws"><span>Saving Throws</span></label>
<input type="checkbox" name="gs-show-saving-throws" id="gs-show-saving-throws" value="false">
</div>
<div class="gs-form-field gs-row-container">
<label for="gs-show-senses"><span>Senses</span></label>
<input type="checkbox" name="gs-show-senses" id="gs-show-senses" value="false">
</div>
<div class="gs-form-field gs-row-container">
<label for="gs-show-classes"><span>Classes</span></label>
<input type="checkbox" name="gs-show-classes" id="gs-show-classes" value="false">
</div>
<div class="gs-form-field gs-row-container">
<label for="gs-show-resources"><span>Resources</span></label>
<input type="checkbox" name="gs-show-resources" id="gs-show-resources" value="false">
</div>
</div>
</div>
</div>
</div>
<div class="gs-stored gs-container">
<div class="gs-header gs-header-controls">Stored</div>
<div class="gs-container gs-row-container">
<div class="gs-camp-currencies gs-container gs-col-container">
<div class="gs-subheader gs-header-camp-currencies">Currencies</div>
<div class="gs-container gs-row-container"></div>
<div class="gs-form-group gs-row-container">
<div class="gs-form-field gs-form-field-number gs-row-container">
<input type="number" name="gs-currency-amount" id="gs-currency-amount" placeholder="Amount">
</div>
<div class="gs-form-field gs-form-field-dropdown gs-row-container">
<select type="number" name="gs-currency-type" id="gs-currency-type"></select>
</div>
<div class="gs-form-field gs-form-field-button gs-row-container">
<button type="button" name="gs-currency-confirm" id="gs-currency-confirm">Amend</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="gs-campaign-row2 gs-container gs-row-container">
<div class="gs-outputs gs-container gs-col-container">
<div class="gs-header gs-header-controls">Known Traits</div>
<div class="gs-container gs-row-container">
<div class="gs-camp-languages gs-col-container">
<div class="gs-subheader gs-header-camp-languages">Known Languages</div>
<div class="gs-container gs-row-container"></div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
//base html that the code gets added to
var mainInfoHTML = `
<div class="gs-main-info gs-wrapper gs-infobox">
<div class="gs-infobox-item1 gs-infobox-item gs-container gs-grid-container gs-row-fill">
<div class="gs-main-able gs-container-line gs-container-spaces">
<div class="gs-header gs-header-able">Abilities</div>
<div class="gs-container gs-row-container"></div>
</div>
<div class="gs-main-saves gs-container-line gs-container-spaces">
<div class="gs-header gs-header-saves">Saving Throws</div>
<div class="gs-container gs-row-container"></div>
</div>
</div>
<div class="gs-infobox-item2 gs-infobox-item gs-container gs-grid-container gs-row-fill">
</div>
<div class="gs-infobox-item3 gs-infobox-item gs-container gs-col-container">
<div class="gs-senses gs-col-container gs-container-spaces">
<div class="gs-header gs-header-senses">Senses</div>
<div class="gs-passives">
<div class="gs-subheader gs-header-passives">Passives</div>
<div class="gs-container gs-col-container">
<div class="gs-box gs-box-callout gs-passivePerception">
<div class="gs-box-background">` + calloutBoxSVG + `</div>
<div class="gs-number gs-passives-number"></div>
<div class="gs-label gs-passives-label">Perception</div>
</div>
<div class="gs-box gs-box-callout gs-passiveInvestigation">
<div class="gs-box-background">` + calloutBoxSVG + `</div>
<div class="gs-number gs-passives-number"></div>
<div class="gs-label gs-passives-label">Investigation</div>
</div>
<div class="gs-box gs-box-callout gs-passiveInsight">
<div class="gs-box-background">` + calloutBoxSVG + `</div>
<div class="gs-number gs-passives-number"></div>
<div class="gs-label gs-passives-label">Insight</div>
</div>
</div>
</div>
<div class="gs-additonal-senses">
<div class="gs-subheader gs-header-additonal-senses">Additional Senses</div>
<div class="gs-container gs-col-container"></div>
</div>
</div>
<div class="gs-classes gs-col-container gs-container-spaces">
<div class="gs-header gs-header-classes">Classes</div>
<div class="gs-container gs-col-container"></div>
</div>
<div class="gs-resources gs-col-container gs-container-spaces">
<div class="gs-header gs-header-resources">Resources</div>
<div class="gs-container gs-col-container"></div>
</div>
</div>
</div>
`;
//quick reference that included hitpoints, armor class and initiative bonus
var quickInfoHTML = `
<div class="gs-quick-info gs-wrapper gs-expanded">
<div class="gs-container gs-quickStats gs-quick-info-container">
<div class="gs-container gs-hp gs-flex-items">
<div class="gs-label gs-hp-label">Hit Points</div>
<div class="gs-box gs-hp-box">
<div class="gs-box-background">` + otherBoxSVG + `</div>
<div class="gs-value gs-hp-value">
<span class="gs-number gs-hp-cur"></span>
<span class="gs-number gs-hp-max"></span>
</div>
</div>
</div>
<div class="gs-container gs-ac">
<div class="gs-box gs-ac-box gs-flex-items">
<div class="gs-box-background">` + armorClassBoxSVG + `</div>
<div class="gs-label gs-ac-label">Armor</div>
<div class="gs-number gs-ac-value"></div>
<div class="gs-label gs-ac-label">Class</div>
</div>
</div>
<div class="gs-container gs-intv gs-flex-items">
<div class="gs-label gs-intv-label">Initiative</div>
<div class="gs-box gs-intv-box gs-flex-items">
<div class="gs-box-background">` + initiativeBoxSVG + `</div>
<div class="gs-value gs-intv-value gs-flex-values">
<span class="gs-sign gs-intv-sign"></span>
<span class="gs-number gs-intv-number"></span>
</div>
</div>
</div>
</div>
<div class="gs-miscellaneous gs-col-container gs-container-spaces">
<div class="gs-speeds">
<div class="gs-header gs-header-speeds">Speed</div>
<div class="gs-container gs-row-container"></div>
</div>
</div>
</div>
`;
var abilityHTML = `
<div class="gs-able gs-container gs-flex-items">
<div class="gs-label gs-able-label"></div>
<div class="gs-value gs-able-value">
<div class="gs-prefix gs-able-prefix"></div><span class="gs-number gs-able-number"></span><span class="gs-mod gs-able-mod"> (<span class="gs-sign gs-able-mod-sign"></span><span class="gs-number gs-able-mod-value"></span>)</span>
</div>
</div>
`; //removed gs-flex-values
var savingThrowsHTML = `
<div class="gs-saves gs-container gs-flex-items">
<div class="gs-label gs-saves-label"></div>
<div class="gs-value gs-saves-value">
<div class="gs-prefix gs-saves-prefix"></div><span class="gs-sign gs-saves-sign"></span><span class="gs-number gs-saves-number"></span>
</div>
</div>
`; //removed gs-flex-values
var additonalSenseHTML = `
<div class="gs-additonal-sense gs-container">
<div class="gs-value gs-additonal-sense-value">
<span class="gs-text gs-additonal-sense-text"></span>: <span class="gs-number gs-additonal-sense-number"></span><span class="gs-affix gs-additonal-sense-affix"></span>
</div>
</div>
`;
var classHTML = `
<div class="gs-class gs-container gs-col-container">
<div class="gs-label gs-class-label"></div>
<div class="gs-container gs-row-container">
<div class="gs-spellmod gs-container">
<div class="gs-number gs-spellmod-number"></div>
<div class="gs-label gs-spellmod-label">Modifier</div>
</div>
<div class="gs-spellsavedc gs-container">
<div class="gs-number gs-spellsavedc-number"></div>
<div class="gs-label gs-spellsavedc-label">Save DC</div>
</div>
<div class="gs-spellattack gs-container">
<div class="gs-number gs-spellattack-number"></div>
<div class="gs-label gs-spellattack-label">Attack</div>
</div>
</div>
</div>
`;
var resourcesHTML = `
<div class="gs-resource gs-container gs-col-container">
<div class="gs-container gs-row-container">
<div class="gs-ration gs-class gs-container">
<div class="gs-number gs-ration-number"></div>
<div class="gs-label gs-spellmod-label">Rations</div>
</div>
<div class="gs-healing-potion gs-class gs-container">
<div class="gs-number gs-healing-potion-number">0</div>
<div class="gs-label gs-spellmod-label">Healing<br>Potion</div>
</div>
</div>
`;
var speedHTML = `
<div class="gs-speed gs-container">
<div class="gs-value gs-speed-value">
<span class="gs-number gs-speed-number"></span><span class="gs-affix gs-speed-affix"></span>
</div>
<div class="gs-label gs-speed-label"></div>
</div>
`;
var languageHTML = `
<div class="gs-language">
<span class="gs-text gs-language-text"></span>
</div>
`;
var currencyHTML = `
<div class="gs-camp-currency">
<div class="gs-value gs-currency-value">
<span class="gs-prefix gs-currency-prefix"></span><span class="gs-number gs-currency-number"></span>
</div>
<div class="gs-label gs-currency-label"></div>
</div>
`;
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Custom additonal modules to be loaded with D&DBeyond's module loader
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var initalModules = {
2080: function (module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
console.log("Module 2080: start");
// Unused modules:
// var react = __webpack_require__(0);
// var react_default = __webpack_require__.n(react);
// var react_dom = __webpack_require__(84);
// var react_dom_default = __webpack_require__.n(react_dom);
// var es = __webpack_require__(10);
var dist = __webpack_require__(710);
var dist_default = __webpack_require__.n(dist);
var Core = __webpack_require__(5);
var character_rules_engine_lib_es = __webpack_require__(1);
var character_rules_engine_web_adapter_es = __webpack_require__(136);
var crk = "js";
var ktl = "U";
var cmov = "ab";
var key = "";
for (key in character_rules_engine_lib_es){
if (typeof character_rules_engine_lib_es[key].getAbilities === 'function'){
crk = key;
console.log("crk found: " + key);
}
if (typeof character_rules_engine_lib_es[key].getSenseTypeModifierKey === 'function'){
ktl = key;
console.log("ktl found: " + key);
}
}
for (key in Core){
if (typeof Core[key].WALK !== 'undefined' && typeof Core[key].SWIM !== 'undefined' && typeof Core[key].CLIMB !== 'undefined' && typeof Core[key].FLY !== 'undefined' && typeof Core[key].BURROW !== 'undefined'){
cmov = key;
console.log("cmov found: " + key);
}
}
var charf1 = character_rules_engine_lib_es[crk];
var charf2 = character_rules_engine_lib_es[ktl];
var coref1 = character_rules_engine_lib_es[cmov];
function getAuthHeaders() {
return dist_default.a.makeGetAuthorizationHeaders({});
}
function getCharData(state) {
/*
All parts of the following return are from http://media.dndbeyond.com/character-tools/characterTools.bundle.71970e5a4989d91edc1e.min.js, they are found in functions that have: '_mapStateToProps(state)' in the name, like function CharacterManagePane_mapStateToProps(state)
Any return that uses the function character_rules_engine_lib_es or character_rules_engine_web_adapter_es can be added to this for more return values as this list is not comprehensive.
Anything with selectors_appEnv is unnessisary,as it just returns values in state.appEnv.
*/
console.log("Module 2080: Processing State Info Into Data");
var ruleData = charf1.getRuleData(state);
function getSenseData(senses){ // finds returns the label
return Object.keys(senses).map(function(index) {
let indexInt = parseInt(index);
return {
id: indexInt,
key: charf2.getSenseTypeModifierKey(indexInt),
name: charf2.getSenseTypeLabel(indexInt),
distance: senses[indexInt]
}
})
}
function getSpeedData(speeds){ // finds returns the label
let halfSpeed = roundDown(divide(speeds[Core[cmov].WALK],2));
return Object.keys(speeds).map(function(index) {
let distance = speeds[index];
if(Core[cmov].SWIM === index || Core[cmov].CLIMB === index){
// swim speed is essentiall half walking speed rounded down if character doesn't have a set swim speed:
// source https://www.dndbeyond.com/sources/basic-rules/adventuring#ClimbingSwimmingandCrawling
distance = speeds[index] <= 0 ? halfSpeed : speeds[index];
}
return {
id: charf2.getMovementTypeBySpeedMovementKey(index),
key: index,
name: charf2.getSpeedMovementKeyLabel(index, ruleData),
distance: distance
}
});
}
return {
name: charf1.getName(state),
avatarUrl: charf1.getAvatarUrl(state),
spellCasterInfo: charf1.getSpellCasterInfo(state),
armorClass: charf1.getAcTotal(state),
initiative: charf1.getProcessedInitiative(state),
hasInitiativeAdvantage: charf1.getHasInitiativeAdvantage(state),
resistances: charf1.getActiveGroupedResistances(state),
immunities: charf1.getActiveGroupedImmunities(state),
vulnerabilities: charf1.getActiveGroupedVulnerabilities(state),
conditions: charf1.getActiveConditions(state),
choiceInfo: charf1.getChoiceInfo(state),
classes: charf1.getClasses(state),
feats: charf1.getBaseFeats(state),
race: charf1.getRace(state),
currentXp: charf1.getCurrentXp(state),
preferences: charf1.getCharacterPreferences(state),
totalClassLevel: charf1.getTotalClassLevel(state),
spellCasterInfo: charf1.getSpellCasterInfo(state),
startingClass: charf1.getStartingClass(state),
background: charf1.getBackgroundInfo(state),
notes: charf1.getCharacterNotes(state),
totalWeight: charf1.getTotalWeight(state),
carryCapacity: charf1.getCarryCapacity(state),
pushDragLiftWeight: charf1.getPushDragLiftWeight(state),
encumberedWeight: charf1.getEncumberedWeight(state),
heavilyEncumberedWeight: charf1.getHeavilyEncumberedWeight(state),
preferences: charf1.getCharacterPreferences(state),
currencies: charf1.getCurrencies(state),
attunedSlots: charf1.getAttunedSlots(state),
attunableArmor: charf1.getAttunableArmor(state),
attunableGear: charf1.getAttunableGear(state),
attunableWeapons: charf1.getAttunableWeapons(state),
startingClass: charf1.getStartingClass(state),
background: charf1.getBackgroundInfo(state),
equipped: {
armorItems: charf1.getEquippedArmorItems(state),
weaponItems: charf1.getEquippedWeaponItems(state),
gearItems: charf1.getEquippedGearItems(state)
},
unequipped: {
armorItems: charf1.getUnequippedArmorItems(state),
weaponItems: charf1.getUnequippedWeaponItems(state),
gearItems: charf1.getUnequippedGearItems(state)
},
hitPointInfo: charf1.getHitPointInfo(state),
fails: charf1.getDeathSavesFailCount(state),
successes: charf1.getDeathSavesSuccessCount(state),
abilities: charf1.getAbilities(state), // not sure what the difference is between this and abilityLookup, seems to be one is a object, the other an array...
abilityLookup: charf1.getAbilityLookup(state),
proficiencyBonus: charf1.getProficiencyBonus(state),
speeds: getSpeedData(charf1.getCurrentWeightSpeed(state)),
preferences: charf1.getCharacterPreferences(state),
inspiration: charf1.getInspiration(state),
passivePerception: charf1.getPassivePerception(state),
passiveInvestigation: charf1.getPassiveInvestigation(state),
passiveInsight: charf1.getPassiveInsight(state),
senses: getSenseData(charf1.getSenseInfo(state)), //has to be further processed
skills: charf1.getSkills(state),
customSkills: charf1.getCustomSkills(state),
savingThrowDiceAdjustments: charf1.getSavingThrowDiceAdjustments(state),
situationalBonusSavingThrowsLookup: charf1.getSituationalBonusSavingThrowsLookup(state),
deathSaveInfo: charf1.getDeathSaveInfo(state),
proficiencyGroups: charf1.getProficiencyGroups(state),
background: charf1.getBackgroundInfo(state),
alignment: charf1.getAlignment(state),
height: charf1.getHeight(state),
weight: charf1.getWeight(state),
size: charf1.getSize(state),
faith: charf1.getFaith(state),
skin: charf1.getSkin(state),
eyes: charf1.getEyes(state),
hair: charf1.getHair(state),
age: charf1.getAge(state),
gender: charf1.getGender(state),
traits: charf1.getCharacterTraits(state),
notes: charf1.getCharacterNotes(state),
levelSpells: charf1.getLevelSpells(state),
spellCasterInfo: charf1.getSpellCasterInfo(state),
ruleData: charf1.getRuleData(state),
xpInfo: charf1.getExperienceInfo(state),
spellSlots: charf1.getSpellSlots(state),
pactMagicSlots: charf1.getPactMagicSlots(state),
attunedSlots: charf1.getAttunedSlots(state),
hasMaxAttunedItems: charf1.hasMaxAttunedItems(state),
weaponSpellDamageGroups: charf1.getWeaponSpellDamageGroups(state),
inventory: charf1.getInventory(state),
creatures: charf1.getCreatures(state),
customItems: charf1.getCustomItems(state),
weight: charf1.getTotalWeight(state),
weightSpeedType: charf1.getCurrentWeightType(state),
notes: charf1.getCharacterNotes(state),
currencies: charf1.getCurrencies(state),
activatables: charf1.getActivatables(state),
attacks: charf1.getAttacks(state),
weaponSpellDamageGroups: charf1.getWeaponSpellDamageGroups(state),
attacksPerActionInfo: charf1.getAttacksPerActionInfo(state),
ritualSpells: charf1.getRitualSpells(state),
spellCasterInfo: charf1.getSpellCasterInfo(state),
originRefRaceData: charf1.getDataOriginRefRaceData(state),
hasSpells: charf1.hasSpells(state),
optionalOrigins: charf1.getOptionalOrigins(state),
}
}
window.moduleExport = {
getCharData : getCharData,
getAuthHeaders : getAuthHeaders,
}
console.log("Module 2080: end");
}
};
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Main Function
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(function () {
campaignID = window.location.pathname.match(charIDRegex);
stylesheetUrls.forEach(loadStylesheet); //load and insert each stylesheet in the settings
loadModules(initalModules); //load the module loader which imports from window.jsonpDDBCT and the inputted modules
insertCampaignElements();
findTargets();
insertElements();
window.moduleExport.getAuthHeaders()().then((function (headers) {
authHeaders = headers;
console.log("authHeaders: ", headers);
retriveRules().then(() =>{
updateAllCharData();
}).catch((error) => {
console.log(error);
});
}));
})();
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function findTargets() {
console.log("Locating Characters from Window");
$(linkUrlTarget).each(function (index, value) {
var url = value.html;
console.debug("Processing: " + url);
var charID = 0;
var matchArr = value.href.match(charIDRegex);
if (matchArr.length > 0) {
var charIDStr = matchArr[1];
if (charIDStr == "") {
console.warn("error: empty charIdStr");
} else {
charID = parseInt(charIDStr);
}
} else {
console.warn("error: no numbers found in " + value.href);
}
if (charID != 0) {
let node = $(value).parents('li');
let type = 'unknown';
let typeNode = $(value).parents('.ddb-campaigns-detail-body-listing');
if(typeNode.hasClass('ddb-campaigns-detail-body-listing-active')){
let unassignedNode = $(value).parents('.ddb-campaigns-detail-body-listing-unassigned-active');
if(unassignedNode.length > 0){
type = 'unassigned';
} else {
type = 'active';
}
} else if(typeNode.hasClass('ddb-campaigns-detail-body-listing-inactive')){
type = 'deactivated';
}
charactersData[charID] = {
node: node,
url: charJSONurlBase + charID,
state: {
appEnv: {
authEndpoint: "https://auth-service.dndbeyond.com/v1/cobalt-token", characterEndpoint: "", characterId: charID, characterServiceBaseUrl: null, diceEnabled: true, diceFeatureConfiguration: {
apiEndpoint: "https://dice-service.dndbeyond.com", assetBaseLocation: "https://www.dndbeyond.com/dice", enabled: true, menu: true, notification: false, trackingId: ""
}, dimensions: { sheet: { height: 0, width: 1200 }, styleSizeType: 4, window: { height: 571, width: 1920 } }, isMobile: false, isReadonly: false, redirect: undefined, username: "example"
},
appInfo: { error: null },
character: {},
characterEnv: { context: "SHEET", isReadonly: false, loadingStatus: "LOADED" },
confirmModal: { modals: [] },
modal: { open: {} },
ruleData: {},
serviceData: { classAlwaysKnownSpells: {}, classAlwaysPreparedSpells: {}, definitionPool: {}, infusionsMappings: [], knownInfusionsMappings: [], ruleDataPool: {}, vehicleComponentMappings: [], vehicleMappings: [] },
sheet: { initError: null, initFailed: false },
sidebar: { activePaneId: null, alignment: "right", isLocked: false, isVisible: false, panes: [], placement: "overlay", width: 340 },
syncTransaction: { active: false, initiator: null },
toastMessage: {}
},
data: {},
type: type,
}
for (let ruleID in optionalRules){
charactersData[charID].state.serviceData.definitionPool[optionalRules[ruleID].category] = {
accessTypeLookup:{},
definitionLookup:{},
};
}
} else {
console.warn("warn: skipping " + value.href + " due to ID not found");
}
});
console.log("Finished locating Characters from Window");
//console.debug(charactersData);
}
function insertElements() {
console.log("Inserting Structual Elements");
for(let id in charactersData) {
let node = charactersData[id].node;
node.addClass('.gs-' + id);
node.append(mainInfoHTML); // add the structure for the main info adjacent ro the player card;
node.find('.ddb-campaigns-character-card-header').append(quickInfoHTML); // add the structure for quick stats inside player card
};
}
function retriveRules(charIDs) {
return new Promise(function (resolve, reject) {
console.log("Retriving Rules Data");
getJSONfromURLs(rulesUrls).then((js) => {
console.log("Rules Data Processing Start");
js.forEach(function(rule, index){
isSuccessfulJSON(rule, index);
});
rulesData = {
ruleset : js[0].data,
vehiclesRuleset : js[1].data
}
for(let id in charactersData){
charactersData[id].state.ruleData = rulesData.ruleset;
charactersData[id].state.serviceData.ruleDataPool = rulesData.vehiclesRuleset;
}
console.debug("Rules Data:");
console.debug(rulesData);
resolve();
}).catch((error) => {
reject(error);
});
});
}
function getRules(index){
return rulesData[index];
}
function updateAllCharData() {
console.log("Retriving Each Char Data");
//console.debug(charactersData);
let promises = []
for(let id in charactersData){
promises.push(updateCharData(charactersData[id].url));
}
//console.log(charactersData);
Promise.all(promises)
.then(() =>{
updateCampaignData();
}).catch((error) => {
console.log(error);
});
updateVisibility();
startRefreshTimer();
console.log("Updated All Char Data");
}
function updateCharData(url) {
return new Promise(function (resolve, reject) {
console.log("Retriving Char Data");
getJSONfromURLs([url]).then((js) => {
//window.jstest = js;
js.forEach(function(charJSON, index){
if(isSuccessfulJSON(charJSON, index)){
let charId = charJSON.data.id;
console.debug("Processing Char: " + charId);
charactersData[charId].state.character = charJSON.data;
let promises = retriveCharacterRules(charId)
Promise.all(promises).then(()=>{
var charData = window.moduleExport.getCharData(charactersData[charId].state);
charactersData[charId].data = charData;
updateElementData(charactersData[charId]);
console.log("Retrived Char Data for char " + charId + " aka " + charactersData[charId].data.name);
console.log(charactersData[charId]);
resolve();
});
} else {
console.log("Char URL " + url + " was skipped");
}
});
}).catch((error) => {
console.log(error);
reject();
});
});
}
function retriveCharacterRules(charId) {
let promises = [];
console.log("Looking for optional rules for " + charactersData[charId].data.name);
for(let ruleID in optionalRules){
if(ruleID in charactersData[charId].state.character && charactersData[charId].state.character[ruleID].length > 0 ){
console.log("Optional ruleset for " + ruleID + " found.");
promises.push(retriveCharacterRule(charId, ruleID));
}
}
return promises;
}
function retriveCharacterRule(charId, ruleID) {
let url = gameCollectionUrl.prefix + optionalRules[ruleID].category + gameCollectionUrl.postfix;
let ruleIds = []
for(let item of charactersData[charId].state.character[ruleID]){
ruleIds.push(item[optionalRules[ruleID].id]);
}
let body = {"campaignId":null,"sharingSetting":2,"ids":ruleIds};
return new Promise(function (resolve, reject) {
getJSONfromURLs([url], body).then((js) => {
js.forEach(function(charJSON, index){
console.log("Retrived " + ruleID + " data, processing.");
console.log(charJSON);
if(charJSON.success && charJSON.data.definitionData != undefined){
for(let data of charJSON.data.definitionData){
charactersData[charId].state.serviceData.definitionPool[optionalRules[ruleID].category].definitionLookup[data.id] = data;
charactersData[charId].state.serviceData.definitionPool[optionalRules[ruleID].category].accessTypeLookup[data.id] = 1;
}
}
console.log(ruleID + " finished processing.");
});
resolve();
}).catch((error) => {
console.log(error);
reject();
});
});
}
function startRefreshTimer() {
//get timeout value
let refreshTime = parseInt($('input[name ="gs-auto-duration"]').val());
let refreshTimeMiliSecs = refreshTime * 1000;
console.log("Starting Refresh Timer: " + refreshTime);
setTimeout(function () {
//only refresh when checkbox is checked
if ($('input[name ="gs-auto-update"]').is(':checked')) {
updateAllCharData();
}else{
startRefreshTimer();
}
}, refreshTimeMiliSecs);
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Element Updating Functions
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function insertCampaignElements() {
console.log("Inseting Campaign Elements");
let campaignPrefix = scriptVarPrefix + "-" + campaignID;
$(campaignElementTarget + " > div:nth-child(1)").after(controlsHTML);
campaignNode = $(".gs-campaign");
insertControls(campaignNode, campaignPrefix);
insertVisibilityControls(campaignNode, campaignPrefix);
insertStoredElements(campaignNode, campaignPrefix);
}
function insertControls(parent, campaignPrefix) {
console.log("Inseting Main Controls");
let controlsNode = parent.find('.gs-controls');
let autoUpdate = controlsNode.find('input[name ="gs-auto-update"]');
let autoDuration = controlsNode.find('input[name ="gs-auto-duration"]');
// Loads ideally value set for this campaign, if not found it loads the last saved value otherwise it defaults
let autoUpdateLoaded = GM_getValue(campaignPrefix + "-autoUpdate", GM_getValue(scriptVarPrefix + "-autoUpdate", autoUpdateDefault));
let updateDurationLoaded = GM_getValue(campaignPrefix + "-updateDuration", GM_getValue(scriptVarPrefix + "-updateDuration", updateDurationDefault))
autoUpdate.prop('checked', autoUpdateLoaded);
autoDuration.prop('value', updateDurationLoaded);
autoUpdate.change(function () {
let updatedAutoUpdate = parseBool($(this).prop("checked"));
GM_setValue(campaignPrefix + "-autoUpdate", updatedAutoUpdate);
GM_setValue(scriptVarPrefix + "-autoUpdate", updatedAutoUpdate);
});
autoDuration.change(function () {
let updatedAutoDuration = parseIntSafe($(this).val());
GM_setValue(campaignPrefix + "-updateDuration", updatedAutoDuration);
GM_setValue(scriptVarPrefix + "-updateDuration", updatedAutoDuration);
});
}
function insertVisibilityControls(parent, campaignPrefix) {
console.log("Inseting Visibility Controls");
let controlsNode = parent.find('.gs-views');
let showAbilities = controlsNode.find('input[name ="gs-show-abilities"]');
let showSavingThrows = controlsNode.find('input[name ="gs-show-saving-throws"]');
let showSenses = controlsNode.find('input[name ="gs-show-senses"]');
let showClasses = controlsNode.find('input[name ="gs-show-classes"]');
let showResources = controlsNode.find('input[name ="gs-show-resources"]');
// Loads ideally value set for this campaign, if not found it loads the last saved value otherwise it defaults
let showAbilitiesLoaded = GM_getValue(campaignPrefix + "-showAbilities", GM_getValue(scriptVarPrefix + "-showAbilities", showAbilitiesDefault));
let showSavingThrowsLoaded = GM_getValue(campaignPrefix + "-showSavingThrows", GM_getValue(scriptVarPrefix + "-showSavingThrows", showSavingThrowsDefault));
let showSensesLoaded = GM_getValue(campaignPrefix + "-showSenses", GM_getValue(scriptVarPrefix + "-showSenses", showSensesDefault));
let showClassesLoaded = GM_getValue(campaignPrefix + "-showClasses", GM_getValue(scriptVarPrefix + "-showClasses", showClassesDefault));
let showResourcesLoaded = GM_getValue(campaignPrefix + "-showResources", GM_getValue(scriptVarPrefix + "-showResources", showResourcesDefault));
showAbilities.prop('checked', showAbilitiesLoaded);
showSavingThrows.prop('checked', showSavingThrowsLoaded);
showSenses.prop('checked', showSensesLoaded);
showClasses.prop('checked', showClassesLoaded);
showResources.prop('checked', showResourcesLoaded);
showAbilities.change(function () {
let updatedShowAbilities = parseBool($(this).prop("checked"));
GM_setValue(campaignPrefix + "-showAbilities", updatedShowAbilities);
GM_setValue(scriptVarPrefix + "-showAbilities", updatedShowAbilities);
updateVisibility();
});
showSavingThrows.change(function () {
let updatedShowSavingThrows = parseBool($(this).prop("checked"));
GM_setValue(campaignPrefix + "-showSavingThrows", updatedShowSavingThrows);
GM_setValue(scriptVarPrefix + "-showSavingThrows", updatedShowSavingThrows);
updateVisibility();
});
showSenses.change(function () {
let updatedShowSensesUpdate = parseBool($(this).prop("checked"));
GM_setValue(campaignPrefix + "-showSenses", updatedShowSensesUpdate);
GM_setValue(scriptVarPrefix + "-showSenses", updatedShowSensesUpdate);
updateVisibility();
});
showClasses.change(function () {
let updatedShowClasses = parseBool($(this).prop("checked"));
GM_setValue(campaignPrefix + "-showClasses", updatedShowClasses);
GM_setValue(scriptVarPrefix + "-showClasses", updatedShowClasses);
updateVisibility();
});
showResources.change(function () {
let updatedShowResources = parseBool($(this).prop("checked"));
GM_setValue(campaignPrefix + "-showResources", updatedShowResources);
GM_setValue(scriptVarPrefix + "-showResources", updatedShowResources);
updateVisibility();
});
}
function updateVisibility() {
console.log("Updating data visibility");
let abilities = $('input[name ="gs-show-abilities"]').is(':checked');
let saves = $('input[name ="gs-show-saving-throws"]').is(':checked');
let senses = $('input[name ="gs-show-senses"]').is(':checked');
let classes = $('input[name ="gs-show-classes"]').is(':checked');
let resources = $('input[name ="gs-show-resources"]').is(':checked');
$('.gs-main-able').toggle(abilities);
$('.gs-main-saves').toggle(saves);
$('.gs-main-able').parents('.gs-container').toggle(abilities || saves);
$('.gs-senses').toggle(senses);
$('.gs-classes').toggle(classes);
$('.gs-resources').toggle(resources);
$('.gs-senses').parents('.gs-container').toggle(senses || classes || resources);
}
function insertStoredElements(parent, campaignPrefix) {
console.log("Inseting Stored Elements");
let storedNode = parent.find('.gs-stored');
insertCurrencies(storedNode, campaignPrefix);
}
function insertCurrencies(parent, campaignPrefix){
console.log("Updating Campaign Currencies Data");
let currenciesLoaded = GM_getValue(campaignPrefix + "-currencies", currenciesDefault);
//console.log(currenciesLoaded);
let container = parent.find('.gs-camp-currencies > .gs-container');
let currencyAmount = parent.find('.gs-camp-currencies > .gs-form-group input[name="gs-currency-amount"]');
let currencyType = parent.find('.gs-camp-currencies > .gs-form-group select[name="gs-currency-type"]');
let currencyConfirm = parent.find('.gs-camp-currencies > .gs-form-group button[name="gs-currency-confirm"]');
for(let id in currenciesTypeDefault){
let currency = currenciesTypeDefault[id];
$('<option/>', {
value: id,
class: 'gs-currency-type-option gs-currency-type-' + id + '-option',
html: currency.name
}).appendTo(currencyType);
}
currencyType.val(currenciesMainDefault);
currencyConfirm.click(function () {
let updatedAmount = parseIntSafe(currencyAmount.val());
if(updatedAmount != 0){
let selectedType = currencyType.val();
if(updatedAmount != undefined){
let currenciesUpdate = GM_getValue(campaignPrefix + "-currencies", currenciesDefault);
if(currenciesUpdate[selectedType] == undefined){
currenciesUpdate[selectedType] = 0;
}
currenciesUpdate[selectedType] += updatedAmount;
GM_setValue(campaignPrefix + "-currencies", currenciesUpdate);
updateCurrency(container, selectedType, currenciesUpdate[selectedType]);
}
}
});
for(let id in currenciesLoaded){
updateCurrency(container, id, currenciesLoaded[id]);
}
}
function updateCurrency(parent, id, value){
let curCurrency = parent.find('.gs-currency-' + id);
//console.log(curCurrency);
if (curCurrency.length < 1) {
parent.append(currencyHTML);
curCurrency = parent.children().last();
curCurrency.addClass('gs-currency-' + id);
curCurrency.find('.gs-currency-label').html(id);
}
curCurrency.find('.gs-currency-number').html(value);
}
function updateCampaignData(){
console.log("Updating Campaign Data");
let outputsNode = campaignNode.find(".gs-outputs");
updateLanguages(outputsNode);
}
function updateLanguages(parent){
console.log("Updating Campaign Languages Data");