-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcsvToJson.py
1384 lines (1258 loc) · 59 KB
/
csvToJson.py
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
import csv
import json
import re
import time
import os
import datetime
starttime = time.time()
#Define all file paths
#Trinkets
trinketsSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_SC.csv'))
trinketsAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_AS.csv'))
trinketsSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_Dungeons_SC.csv'))
trinketsASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_Dungeons_AS.csv'))
#Triats
traitsSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_SC.csv'))
traitsAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_AS.csv'))
traitsSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_Dungeons_SC.csv'))
traitsASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_Dungeons_AS.csv'))
#Essences
essencesSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_SC.csv'))
essencesAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_AS.csv'))
essencesSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_Dungeons_SC.csv'))
essencesASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_Dungeons_AS.csv'))
#Talents
talents = os.path.os.path.abspath(os.path.join(os.getcwd(), 'talents/Results.csv'))
talentsD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'talents/results_Dungeons.csv'))
#Racials
racialsAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Results_AS.csv'))
racialsASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Results_Dungeons_AS.csv'))
racialsSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Results_SC.csv'))
racialsSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Results_Dungeons_SC.csv'))
#Enchants
enchantsAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/Results_AS.csv'))
enchantsASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/Results_Dungeons_AS.csv'))
enchantsSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/Results_SC.csv'))
enchantsSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/Results_Dungeons_SC.csv'))
#Consumables
consumablesAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/Results_AS.csv'))
consumablesASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/Results_Dungeons_AS.csv'))
consumablesSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/Results_SC.csv'))
consumablesSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/Results_Dungeons_SC.csv'))
#Corruption
corruptionAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_AS.csv'))
corruptionASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_Dungeons_AS.csv'))
corruptionSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_SC.csv'))
corruptionSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_Dungeons_SC.csv'))
#Corruption DPS Point Values
corruptionPointAS = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_AS.csv'))
corruptionPointASD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_Dungeons_AS.csv'))
corruptionPointSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_SC.csv'))
corruptionPointSCD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_Dungeons_SC.csv'))
#JSON Files
#Trinkets
trinketsSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_SC.json'))
trinketsASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_AS.json'))
trinketsSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_SC_D.json'))
trinketsASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/Results_AS_D.json'))
#Traits
traitsSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_SC.json'))
traitsASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_AS.json'))
traitsSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_SC_D.json'))
traitsASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'azerite-traits/Results_AS_D.json'))
#Corruption
corruptionSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_SC.json'))
corruptionASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_AS.json'))
corruptionSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_SC_D.json'))
corruptionASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Results_AS_D.json'))
#CorruptionDPSPointValues
corruptionPointSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_SC.json'))
corruptionPointASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_AS.json'))
corruptionPointSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_SC_D.json'))
corruptionPointASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'corruption/Corruption_Value_Results_AS_D.json'))
#Essences
essencesSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_SC.json'))
essencesASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_AS.json'))
essencesSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_SC_D.json'))
essencesASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'essences/Results_AS_D.json'))
#Talents
talentsJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'talents/Results.json'))
talentsJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'talents/Results_D.json'))
#Racials
racialsASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Results_AS.json'))
racialsASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Racials_AS_D.json'))
racialsSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Results_SC.json'))
racialsSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'racials/Racials_SC_D.json'))
#Enchants
enchantsASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/Results_AS.json'))
enchantsASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/enchants_AS_D.json'))
enchantsSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/Results_SC.json'))
enchantsSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'enchants/enchants_SC_D.json'))
#Consumables
consumablesASJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/Results_AS.json'))
consumablesASJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/consumables_AS_D.json'))
consumablesSCJson = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/Results_SC.json'))
consumablesSCJsonD = os.path.os.path.abspath(os.path.join(os.getcwd(), 'consumables/consumables_SC_D.json'))
# SimC files
trinketsDungeonsSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/trinkets_dungeons_SC.simc'))
trinketsOtherSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/trinkets_other_SC.simc'))
trinketsRaidSC = os.path.os.path.abspath(os.path.join(os.getcwd(), 'trinkets/trinkets_raid_SC.simc'))
#CSV Field names
fieldnames = ('profile', 'actor', 'DPS', 'increase')
now = datetime.datetime.now()
now = str(now.year) + "/" + str(now.month) + "/" + str(now.day)
# Trait List (hack fix for the moment)
traitList = [
'Ancients_Bulwark_',
'Apothecarys_Concoctions_',
'Arcane_Heart_',
'Barrage_Of_Many_Bombs_',
'Battlefield_Focus_',
'Blightborne_Infusion_',
'Blood_Rite_',
'Bonded_Souls_',
'Champion_of_Azeroth_',
'Chorus_of_Insanity_',
'Clockwork_Heart_',
'Collective_Will_',
'Combined_Might_',
'Dagger_in_the_Back_Behind_',
'Dagger_in_the_Back_Front_',
'Death_Throes_',
'Fight_or_Flight_',
'Filthy_Transfusion_',
'Glory_in_Battle_',
'Incite_the_Pack_',
#'Loyal_to_the_End_',
'Meticulous_Scheming_',
'Relational_Normalization_Gizmo_',
'Retaliatory_Fury_',
'Rezans_Fury_',
'Ricocheting_Inflatable_Pyrosaw_',
'Ruinous_Bolt_',
'Searing_Dialogue_',
'Secrets_of_the_Deep_',
'Seductive_Power_',
'Shadow_of_Elune_',
'Spiteful_Apparitions_',
'Swirling_Sands_',
'Sylvanas_Resolve_',
'Synaptic_Spark_Capacitor_',
'Thought_Harvester_',
'Thunderous_Blast_',
'Tidal_Surge_',
'Tradewinds_',
'Treacherous_Covenant_',
'Undulating_Tides_',
'Unstable_Catalyst_',
'Whispers_of_the_Damned_',
'Loyal_to_the_End_4_Allies_',
'Loyal_to_the_End_3_Allies_',
'Loyal_to_the_End_2_Allies_',
'Loyal_to_the_End_1_Allies_',
'Loyal_to_the_End_0_Allies_',
'Heart_of_Darkness_',
#Secondary Traits
'Azerite_Globules_',
'Blood_Siphon_',
'Earthlink_',
'Elemental_Whirl_',
'Gutripper_',
'Heed_My_Call_',
'On_My_Way_',
'Overwhelming_Power_',
'Unstable_Flames_']
essences = {
#Majors
'Blood of the Enemy' : 'Blood of the Enemy',
'Guardian of Azeroth' : 'Condensed Life-Force',
'Focused Azerite Beam' : 'Essence of the Focusing Iris',
'Purifying Blast' : 'Purification Protocol',
'The Unbound Force' : 'The Unbound Force',
'Memory of Lucid Dreams' : 'Memory of Lucid Dreams',
'Vision of Perfection' : 'Vision of Perfection',
'Conflict' : 'Conflict and Strife',
'Concentrated Flame' : 'The Crucible of Flame',
'Rippled in Space' : 'Rippled in Space',
'Worldvein Resonance' : 'Worldvein Resonance',
'Replica of Knowledge' : 'Formless Void',
'Moment of Glory' : 'Spark of Inspiration',
'Reaping Flames' : 'Breath of the Dying',
#Minors
'Blood-Soaked' : 'Blood of the Enemy',
'Condensed Life-Force' : 'Condensed Life-Force',
'Focused Energy' : 'Essence of the Focusing Iris',
'Purification Protocol' : 'Purification Protocol',
'Reckless Force' : 'The Unbound Force',
'Lucid Dreams' : 'Memory of Lucid Dreams',
'Strive for Perfection' : 'Vision of Perfection',
'Strife' : 'Conflict and Strife',
'Lifeblood' : 'Worldvein Resonance',
'Ancient Flame' : 'The Crucible of Flame',
'Reality Shift' : 'Rippled in Space',
'Symbiotic Presence' : 'Formless Void',
'Unified Strength' : 'Spark of Inspiration',
'Lethal Strikes' : 'Breath of the Dying'
}
def parseCSV(file, json_file):
csv_rows = []
with open(file) as csvfile:
reader = csv.DictReader(csvfile)
field = reader.fieldnames
for row in reader:
csv_rows.extend([{field[i]:row[field[i]] for i in range(len(field))}])
csvToJson(csv_rows, json_file)
def parseCorruptionValuesCSV(file, json_file):
csv_rows = []
with open(file) as csvfile:
reader = csv.DictReader(csvfile)
field = reader.fieldnames
for row in reader:
csv_rows.extend([{field[i]:row[field[i]] for i in range(len(field))}])
csvToJson(csv_rows, json_file)
def csvToJson(data, json_file):
with open(json_file, "w") as f:
f.write(json.dumps(data, sort_keys=False, indent=2, separators=(',', ': ')))
parseCSV(trinketsSC,trinketsSCJson)
parseCSV(trinketsAS,trinketsASJson)
parseCSV(trinketsSCD,trinketsSCJsonD)
parseCSV(trinketsASD,trinketsASJsonD)
parseCSV(traitsSC,traitsSCJson)
parseCSV(traitsAS,traitsASJson)
parseCSV(traitsSCD,traitsSCJsonD)
parseCSV(traitsASD,traitsASJsonD)
parseCSV(corruptionSC,corruptionSCJson)
parseCSV(corruptionAS,corruptionASJson)
parseCSV(corruptionSCD,corruptionSCJsonD)
parseCSV(corruptionASD,corruptionASJsonD)
parseCSV(essencesAS,essencesASJson)
parseCSV(essencesSC,essencesSCJson)
parseCSV(essencesASD,essencesASJsonD)
parseCSV(essencesSCD,essencesSCJsonD)
parseCSV(talents, talentsJson)
parseCSV(talentsD, talentsJsonD)
parseCSV(racialsAS, racialsASJson)
parseCSV(racialsASD, racialsASJsonD)
parseCSV(racialsSC, racialsSCJson)
parseCSV(racialsSCD, racialsSCJsonD)
parseCSV(enchantsAS, enchantsASJson)
parseCSV(enchantsASD, enchantsASJsonD)
parseCSV(enchantsSC, enchantsSCJson)
parseCSV(enchantsSCD, enchantsSCJsonD)
parseCSV(consumablesAS, consumablesASJson)
parseCSV(consumablesASD, consumablesASJsonD)
parseCSV(consumablesSC, consumablesSCJson)
parseCSV(consumablesSCD, consumablesSCJsonD)
parseCorruptionValuesCSV(corruptionPointAS, corruptionPointASJson)
parseCorruptionValuesCSV(corruptionPointASD, corruptionPointASJsonD)
parseCorruptionValuesCSV(corruptionPointSC, corruptionPointSCJson)
parseCorruptionValuesCSV(corruptionPointSCD, corruptionPointSCJsonD)
def getItemId(itemname):
itemname = itemname.lower().rstrip()
if 'PSCD' in itemname:
return 167555
with open(trinketsDungeonsSC, 'r') as f:
lines = f.readlines()
for line in lines:
try:
if re.search(r'(profileset.)\D*',line).group(0).replace('profileset."','').lower() == itemname + '_':
itemID = re.search(r'(id=)\d*',line.strip('\n')).group(0).strip('id=')
return itemID
except:
continue
with open(trinketsOtherSC, 'r') as f:
lines = f.readlines()
for line in lines:
try:
if re.search(r'(trinket1=)\D*',line).group(0).replace('trinket1=','').replace(',id=','').lower() == itemname:
itemID = re.search(r'(id=)\d*',line).group(0).strip('id=')
return itemID
except:
continue
with open(trinketsRaidSC, 'r') as f:
lines = f.readlines()
for line in lines:
try:
if re.search(r'(trinket1=)\D*',line).group(0).replace('trinket1=','').replace(',id=','').lower() == itemname:
itemID = re.search(r'(id=)\d*',line).group(0).strip('id=')
return itemID
except:
continue
def make_unique(original_list):
unique_list = []
[unique_list.append(obj) for obj in original_list if obj not in unique_list]
return unique_list
def getNames(jsonFile):
with open(jsonFile,'r') as f:
nameList = list()
data = json.load(f)
for x in data:
m = re.search(r"\D*",x['actor']).group(0).replace('_',' ').rstrip()
nameList.append(m)
uniqueList = make_unique(nameList)
return uniqueList
def getIlvl(jsonFile):
with open(jsonFile,'r') as f:
nameList = list()
data = json.load(f)
for x in data:
m = re.search(r"\d*",x['actor'].lstrip().split('_')[-1]).group(0)
nameList.append(m)
uniqueList = make_unique(nameList)
uniqueList.sort(reverse=True)
#print(uniqueList)
return uniqueList
def addNamesToJson(jsonFile):
names = getNames(jsonFile)
with open(jsonFile, 'r+') as f:
data = json.load(f)
data.append(names)
f.write(json.dumps(names, sort_keys=False, indent =2))
def ilvlPerItem(itemName):
with open(trinketsASJson) as f:
ilvlList = list()
data = json.load(f)
for x in data:
itemName = itemName.replace('_',' ').rstrip()
n = re.search(r"\D*",x['actor']).group(0).replace('_',' ').rstrip()
m = re.search(r'\d*',x['actor'].lstrip().split('_')[-1]).group(0)
if itemName == n:
ilvlList.append(m)
uniqueList = make_unique(ilvlList)
return uniqueList
trinketnames = getNames(trinketsSCJson)
trinketilvl = getIlvl(trinketsSCJson)
def buildTrinketJsonChart(injsonFile, outjsonFile, simType):
'''
injsonFile - The original CSV data converted to a raw unformatted JSON
outjsonFile - The newly formatted JSON
simType - Composite, Single Target, Dungeons
'''
#trinketnames = getNames(injsonFile) #Get all the trinket names from the inputted JSON file
namelist = list()
j = open(outjsonFile,'w') #Start writing our JSON file
j.write('{\n') #JSON formatting
with open(injsonFile,'r') as f: #Start reading the inputted JSON file.
data = json.load(f)
for x in data: #Easier to parse the originally converted JSON to organize the data
m = re.search(r"\D*",x['actor'].rstrip()).group(0)
namelist.append(m)
uniqueList = make_unique(namelist)
j.write('\t"data": {\n')
ucntMax = len(uniqueList)
ucnt = 0
for u in uniqueList:
ucnt+=1
trinketilvl = ilvlPerItem(u)
j.write('\t\t"' + u.replace('_',' ').rstrip() +'": {\n')
maxCnt = len(trinketilvl)
cnt = 0
for y in trinketilvl:
cnt+=1
for x in data:
if x['profile'] == simType and x['actor'] == str(u+y):
if x['actor'] == 'Base':
j.write('\t\t\t"300": '+x['DPS']+'\n')
else:
if cnt < maxCnt:
j.write('\t\t\t"'+y+'": '+x['DPS']+',\n')
else:
j.write('\t\t\t"'+y+'": '+x['DPS']+'\n')
if ucnt < ucntMax:
j.write('\t\t},\n')
else:
j.write('\t\t}\n')
j.write('\t},\n')
j.write('\t"Data_type": "trinkets",\n\t"item_ids" : {\n')
tempIlvlList = list()
maxCnt = len(uniqueList)
for u in uniqueList:
u = u.replace(' ','_')
if not u == 'Base':
u = u[:-1]
itemID = getItemId(u)
if not str(itemID) == 'None':
tempIlvlList.append('\t\t"'+u+'": '+str(itemID))
else:
if not u == 'Base':
print('Error: ' + u + ' Trinket was not included in the item ID list. Error occured in {} sim'.format(outjsonFile))
finalIlvlList = ',\n'.join(tempIlvlList) + '\n'
j.write(finalIlvlList)
j.write('\t},\n')
j.write('\t"simulated_steps": [\n')
ilvls = getIlvl(injsonFile)
ilvls = ilvls[:-1]
cnt = 0
maxCnt = len(ilvls)
for i in ilvls:
cnt+=1
if cnt < maxCnt:
j.write('\t\t'+str(i)+',\n')
else:
j.write('\t\t'+str(i)+'\n')
j.write('\t],\n')
DPSSort = list()
for u in uniqueList:
try:
maxIlvl = ilvlPerItem(u)[0]
except:
print('Error (Try Statement): ' + u + ' Trinket was not included in the sorted DPS list.')
for x in data:
if x['profile'] == simType and x['actor'] == str(u+maxIlvl):
DPSSort.append(x['DPS'])
sortedTrinkets = [x for _,x in sorted(zip(DPSSort, uniqueList),reverse=True)]
#sortedTrinkets = sortedTrinkets[:-1] #Remove Base since it will always be the last option.
if "Base" in sortedTrinkets: sortedTrinkets.remove("Base")
ucnt = 0
ucntMax = len(sortedTrinkets)
tempList = list()
j.write('\t"sorted_data_keys": [\n')
for s in sortedTrinkets:
s = s.replace('_'," ").strip()
tempList.append('\t\t"' + s+ '"')
finalstring = ',\n'.join(tempList) + '\n'
j.write(finalstring)
"""
for s in sortedTrinkets:
ucnt+=1
if not s == 'Base':
if ucnt < ucntMax:
j.write('\t\t"'+s.replace('_',' ').strip()+'",\n')
else:
j.write('\t\t"'+s.replace('_',' ').strip()+'"\n')
"""
j.write('\t],\n')
#j.write('\n\t},')
j.write('\t"LastUpdated": [\n')
j.write('\t\t"' + now + '"\n')
j.write('\t]')
j.write('\n}')
j.close()
def buildTraitJsonChart(injsonFile, outjsonFile, simType):
'''
injsonFile - The original CSV data converted to a raw unformatted JSON
outjsonFile - The newly formatted JSON
simType - Composite, Single Target, Dungeons
'''
namelist = list()
j = open(outjsonFile,'w') #Start writing our JSON file
j.write('{\n') #JSON formatting
with open(injsonFile,'r') as f: #Start reading the inputted JSON file.
data = json.load(f)
for x in data: #Easier to parse the originally converted JSON to organize the data
m = re.search(r"\D*",x['actor'].rstrip()).group(0)
namelist.append(m)
uniqueList = make_unique(namelist)
uniqueList = traitList
if "Base" in uniqueList: uniqueList.remove("Base")
if "Int_" in uniqueList: uniqueList.remove("Int_")
j.write('\t"data": {\n')
ucntMax = len(uniqueList)
#print(ucntMax)
ucnt = 0
for u in uniqueList:
ucnt+=1
traitSteps = ['1','2','3'] #Should always be 1-3 unless they add some random 4th azerite gear slot
if not u.replace('_',' ').rstrip() == 'Int' or u == 'Base': #Pull the int sims out
j.write('\t\t"' + u.replace('_',' ').rstrip() +'": {\n')
maxCnt = 3
cnt = 0
for y in traitSteps:
cnt+=1
for x in data:
if x['profile'] == simType:
if x['actor'] == str(u+y) and 'base' not in x['actor'].lower():
if x['actor']== ("Champion_of_Azeroth_" + y):
j.write('\t\t\t"1_stack": '+x['DPS']+',\n')
j.write('\t\t\t"2_stack": 0,\n')
j.write('\t\t\t"3_stack": 0\n') #Have to add empty stacks here because highcharts is dumb.
elif 'combo' in x['actor']:
j.write('\t\t\t"1_stack": 0,\n')
j.write('\t\t\t"2_stack": ' + x['DPS']+',\n')
j.write('\t\t\t"3_stack": 0' + '\n')
else:
if cnt < maxCnt:
j.write('\t\t\t"'+y+'_stack": '+x['DPS']+',\n')
else:
j.write('\t\t\t"'+y+'_stack": '+x['DPS']+'\n')
if ucnt < ucntMax:
if not u.replace('_',' ').rstrip() == 'Int': #Have to check for int sims again
j.write('\t\t},\n')
if ucnt == ucntMax:
j.write('\t\t},')
for x in data:
if x['profile'] == simType and x['actor'] == 'Base':
j.write('\n\t\t"Base": {\n')
j.write('\t\t\t"1_stack": '+x['DPS']+',\n')
j.write('\t\t\t"2_stack": 0,\n')
j.write('\t\t\t"3_stack": 0\n') #Have to add empty stacks here because highcharts is dumb.
j.write('\t\t}\n')
j.write('\t},\n')
j.write('\t"Data_type": "traits",\n\t"spell_ids" : {\n')
#Manually write in spell id's for traits
j.write('\t\t"Ancients Bulwark ":'+'"287631"'+',\n')
j.write('\t\t"Apothecarys Concoctions ":'+'"287604"'+',\n')
j.write('\t\t"Arcane Heart ":'+'"303006"'+',\n')
j.write('\t\t"Archive of the Titans ":'+'"280708"'+',\n')
j.write('\t\t"Azerite Empowered ":'+'"263978"'+',\n')
j.write('\t\t"Azerite Globules ":'+'"279955"'+',\n')
j.write('\t\t"Barrage Of Many Bombs ":'+'"280163"'+',\n')
j.write('\t\t"Battlefield Focus ":'+'"280582"'+',\n')
j.write('\t\t"Blightborne Infusion ":'+'"273823"'+',\n')
j.write('\t\t"Blood Rite ":'+'"280409"'+',\n')
j.write('\t\t"Blood Siphon ":'+'"264108"'+',\n')
j.write('\t\t"Bonded Souls ":'+'"288841"'+',\n')
j.write('\t\t"Champion of Azeroth ":'+'"270583"'+',\n')
j.write('\t\t"Chorus of Insanity ":'+'"278661"'+',\n')
j.write('\t\t"Clockwork Heart ":'+'"300210"'+',\n')
j.write('\t\t"Collective Will ":'+'"280837"'+',\n')
j.write('\t\t"Combined Might ":'+'"280848"'+',\n')
j.write('\t\t"Dagger in the Back Behind ":'+'"280285"'+',\n')
j.write('\t\t"Dagger in the Back Front ":'+'"280285"'+',\n')
j.write('\t\t"Death Throes ":'+'"278659"'+',\n')
j.write('\t\t"Earthlink ":'+'"279927"'+',\n')
j.write('\t\t"Elemental Whirl ":'+'"270667"'+',\n')
j.write('\t\t"Endless Hunger ":'+'"287662"'+',\n')
j.write('\t\t"Fight or Flight ":'+'"287818"'+',\n')
j.write('\t\t"Filthy Transfusion ":'+'"273836"'+',\n')
j.write('\t\t"Glory in Battle ":'+'"280852"'+',\n')
j.write('\t\t"Gutripper ":'+'"266937"'+',\n')
j.write('\t\t"Heart of Darkness ":'+'"317137"'+',\n')
j.write('\t\t"Heed My Call ":'+'"271681"'+',\n')
j.write('\t\t"Incite the Pack ":'+'"280410"'+',\n')
j.write('\t\t"Laser Matrix ":'+'"280702"'+',\n')
j.write('\t\t"Loyal to the End 4 Allies ":'+'"303007"'+',\n')
j.write('\t\t"Loyal to the End 3 Allies ":'+'"303007"'+',\n')
j.write('\t\t"Loyal to the End 2 Allies ":'+'"303007"'+',\n')
j.write('\t\t"Loyal to the End 1 Allies ":'+'"303007"'+',\n')
j.write('\t\t"Loyal to the End 0 Allies ":'+'"303007"'+',\n')
j.write('\t\t"Lifespeed":'+'"267665"'+',\n')
j.write('\t\t"Meticulous Scheming ":'+'"273684"'+',\n')
j.write('\t\t"On My Way ":'+'"267879"'+',\n')
j.write('\t\t"Overwhelming Power ":'+'"266180"'+',\n')
j.write('\t\t"Relational Normalization Gizmo ":'+'"280178"'+',\n')
j.write('\t\t"Retaliatory Fury ":'+'"280785"'+',\n')
j.write('\t\t"Rezans Fury ":'+'"281834"'+',\n')
j.write('\t\t"Ricocheting Inflatable Pyrosaw ":'+'"280168"'+',\n')
j.write('\t\t"Ruinous Bolt ":'+'"280206"'+',\n')
j.write('\t\t"Searing Dialogue ":'+'"272788"'+',\n')
j.write('\t\t"Secrets of the Deep ":'+'"273829"'+',\n')
j.write('\t\t"Shadow of Elune ": ' + '"287471" ' + ',\n')
j.write('\t\t"Spiteful Apparitions ":'+'"277682"'+',\n')
j.write('\t\t"Swirling Sands ":'+'"280433"'+',\n')
j.write('\t\t"Sylvanas Resolve ":'+'"280810"'+',\n')
j.write('\t\t"Synaptic Spark Capacitor ":'+'"280174"'+',\n')
j.write('\t\t"Thought Harvester ":'+'"273320"'+',\n')
j.write('\t\t"Thunderous Blast ":'+'"280384"'+',\n')
j.write('\t\t"Tidal Surge ":'+'"280404"'+',\n')
j.write('\t\t"Tradewinds ":'+'"281843"'+',\n')
j.write('\t\t"Treacherous Covenant ":'+'"288989"'+',\n')
j.write('\t\t"Undulating Tides ":'+'"303008"'+',\n')
j.write('\t\t"Unstable Catalyst ":'+'"281516"'+',\n')
j.write('\t\t"Unstable Flames ":'+'"279902"'+',\n')
j.write('\t\t"Whispers of the Damned ":'+'"275726"'+'\n')
j.write('\t},\n')
#end manual
j.write('\t"simulated_steps": [\n')
#write the 3 levels of traits
j.write('\t\t"1_stack",\n')
j.write('\t\t"2_stack",\n')
j.write('\t\t"3_stack"\n')
j.write('\t],\n')
DPSSort = dict()
for u in traitList:
trait = u
trait.replace(" ", "_")
totalDPS = 0
for x in data:
if x['profile'] == simType:
if x['actor'] == str(trait+'1'):
totalDPS += int(x['DPS'])
if x['actor'] == str(trait+'2'):
totalDPS += int(x['DPS'])
if x['actor'] == str(trait+'3'):
totalDPS += int(x['DPS'])
DPSSort.update({u : totalDPS})
#if "Int_" in uniqueList: uniqueList.remove("Int_")
import operator
sorted_x = sorted(DPSSort.items(), key=operator.itemgetter(1), reverse=True)
j.write('\t"sorted_data_keys": [\n')
cnt=0
ucntMax = len(sorted_x)
for key in sorted_x:
cnt+=1
if 'Int' not in key[0]:
if cnt < ucntMax:
j.write('\t\t "' + key[0].replace("_"," ").rstrip() + '",\n')
else:
j.write('\t\t "' + key[0].replace("_"," ").rstrip() + '"\n')
j.write('\t]')
#j.write('\n\t},')
j.write('\n}')
j.close()
def buildTraitJsonComboChart(injsonFile, outjsonFile, simType):
namelist = list()
j = open(outjsonFile,'w') #Start writing our JSON file
j.write('{\n') #JSON formatting
with open(injsonFile,'r') as f: #Start reading the inputted JSON file.
data = json.load(f)
for x in data: #Easier to parse the originally converted JSON to organize the data
m = re.search(r"\w*",x['actor'].rstrip()).group(0)
if "combo" in m:
namelist.append(m)
uniqueList = make_unique(namelist)
if "Base" in uniqueList: uniqueList.remove("Base")
j.write('\t"data": {\n')
ucntMax = len(uniqueList)
#print(ucntMax)
ucnt = 0
for u in uniqueList:
ucnt+=1
traitSteps = ['1']
if not u.replace('_',' ').rstrip() == 'Int' or u == 'Base': #Pull the int sims out
j.write('\t\t"' + u.replace('_',' ').replace('combo 6', ' ').replace('combo 5', ' ').replace('combo 4', ' ').replace('combo 3', ' ').replace('combo 2', ' ').rstrip() +'": {\n')
maxCnt = 3
cnt = 0
for y in traitSteps:
cnt+=1
for x in data:
if x['profile'] == simType:
if x['actor'] == str(u):
if cnt < maxCnt:
j.write('\t\t\t"'+'1_stack": '+x['DPS']+'\n')
else:
j.write('\t\t\t"'+'1_stack": '+x['DPS']+'\n')
if ucnt < ucntMax:
if not u.replace('_',' ').rstrip() == 'Int': #Have to check for int sims again
j.write('\t\t},\n')
else:
j.write('\t\t},')
for x in data:
if x['profile'] == simType and x['actor'] == 'Base':
j.write('\n\t\t"Base": {\n')
j.write('\t\t\t"1_stack": '+x['DPS']+',\n')
j.write('\t\t}\n')
j.write('\t},\n')
DPSSort = list()
for u in uniqueList:
for x in data:
if x['profile'] == simType and x['actor'] == str(u):
DPSSort.append(x['DPS'])
#if "Int_" in uniqueList: uniqueList.remove("Int_")
sortedTraits = [x for _,x in sorted(zip(DPSSort, uniqueList),reverse=True)]
j.write('\t"sorted_data_keys": [\n')
ucntMax = len(sortedTraits)
ucnt = 0
for s in sortedTraits:
ucnt+=1
if not s == 'Base':
s = s.replace('_',' ')
s = s.replace(" combo 6", ' ')
s = s.replace(" combo 5", ' ')
s = s.replace(" combo 4", ' ')
s = s.replace(" combo 3", ' ')
s = s.replace(" combo 2", ' ')
s = s.rstrip()
if ucnt < ucntMax:
j.write('\t\t"'+s+'",\n')
else:
j.write('\t\t"'+s+'"\n')
j.write('\t]')
#j.write('\n\t},')
j.write('\n}')
j.close()
def buildEssenceJsonChart(injsonFile, outjsonFile, simType):
namelist = list()
j = open(outjsonFile,'w') #Start writing our JSON file
j.write('{\n') #JSON formatting
with open(injsonFile,'r') as f: #Start reading the inputted JSON file.
data = json.load(f)
for x in data: #Easier to parse the originally converted JSON to organize the data
m = re.search(r"\D*",x['actor'].rstrip()).group(0)
namelist.append(m)
uniqueList = make_unique(namelist)
if "Base" in uniqueList: uniqueList.remove("Base")
if "Blood_of_the_Enemy_" in uniqueList: uniqueList.remove("Blood_of_the_Enemy_")
if "Lifeblood_" in uniqueList: uniqueList.remove("Lifeblood_")
if "Worldvein_Resonance_" in uniqueList: uniqueList.remove("Worldvein_Resonance_")
j.write('\t"data": {\n')
ucntMax = len(uniqueList)
ucnt = 0
for u in uniqueList:
j.write('\t\t"' + u.replace('_',' ').rstrip() +'": {\n')
ucnt+=1
essenceSteps = ['3', '2','1']
maxCnt = 3
cnt = 0
for y in essenceSteps:
cnt+=1
for x in data:
if x['profile'] == simType:
if x['actor'] == str(u) + y:
if cnt < maxCnt:
j.write('\t\t\t"'+'rank_'+ y + '": '+x['DPS']+',\n')
else:
j.write('\t\t\t"'+'rank_1": '+x['DPS']+'\n')
if ucnt < ucntMax:
if not u.replace('_',' ').rstrip() == 'Int': #Have to check for int sims again
j.write('\t\t},\n')
else:
j.write('\t\t},')
for x in data:
if x['profile'] == simType and x['actor'] == 'Base':
j.write('\n\t\t"Base": {\n')
j.write('\t\t\t"rank_1": '+x['DPS']+'\n')
j.write('\t\t},\n')
# Special Handling for Blood of the Enemy
essenceSteps = ['3', '2','1']
maxCnt = 3
boteList = list()
for x in data:
if 'Blood_of_the_Enemy_' in x['actor']:
temp = x['actor'].replace('_Uptime','')
temp = temp[:-2]
boteList.append(temp)
boteList = make_unique(boteList)
ucnt = 0
ucntMax = len(boteList)
for b in boteList:
ucnt+=1
cnt = 0
j.write('\t\t"' + b.replace("_"," ") +'": {\n')
for e in essenceSteps:
cnt+=1
for x in data:
if x['profile'] == simType:
if x['actor'].replace('_Uptime','') == b + '_' + e:
if cnt < maxCnt:
j.write('\t\t\t"' + 'rank_' + e + '": '+ x['DPS']+',\n')
else:
j.write('\t\t\t"'+'rank_1": '+x['DPS']+'\n')
j.write('\t\t},\n')
#Special Handling for WorldVein
worldVeinList = list()
for x in data:
if "Worldvein" in x['actor']:
temp = x['actor'].replace('Allies','')
temp = temp[:-3]
worldVeinList.append(temp)
worldVeinList = make_unique(worldVeinList)
allySteps = ['4','3','2','1']
ucnt=0
ucntMax = len(worldVeinList)
for l in worldVeinList:
ucnt+=1
cnt = 0
j.write('\t\t"' + l.replace('_',' ') + ' Allies' + '":{\n')
for e in essenceSteps:
cnt+=1
for x in data:
if x['profile'] == simType:
if x['actor'] == l + '_Allies_' + e:
if cnt < maxCnt:
j.write('\t\t\t"' + 'rank_' + e + '": '+ x['DPS']+',\n')
else:
j.write('\t\t\t"'+'rank_1": '+x['DPS']+'\n')
j.write('\t\t},\n')
#Special Handling for Lifeblood
lifeBloodList = list()
for x in data:
if "Lifeblood" in x['actor']:
temp = x['actor'].replace('Allies','')
temp = temp[:-3]
lifeBloodList.append(temp)
lifeBloodList = make_unique(lifeBloodList)
allySteps = ['4','3','2','1']
ucnt=0
ucntMax = len(lifeBloodList)
for l in lifeBloodList:
ucnt+=1
cnt = 0
j.write('\t\t"' + l.replace('_',' ') + ' Allies' + '":{\n')
for e in essenceSteps:
cnt+=1
for x in data:
if x['profile'] == simType:
if x['actor'] == l + '_Allies_' + e:
if cnt < maxCnt:
j.write('\t\t\t"' + 'rank_' + e + '": '+ x['DPS']+',\n')
else:
j.write('\t\t\t"'+'rank_1": '+x['DPS']+'\n')
if ucnt < ucntMax:
j.write('\t\t},\n')
else:
j.write('\t\t}\n')
j.write('\t},\n')
j.write('\t"spell_ids" : {\n')
#Majors
j.write('\t\t"Focused Azerite Beam" : 295258,\n')
j.write('\t\t"Guardian of Azeroth" : 295840,\n')
j.write('\t\t"Purifying Blast" : 295337,\n')
j.write('\t\t"The Unbound Force" : 298452,\n')
j.write('\t\t"Memory of Lucid Dreams" : 298357,\n')
j.write('\t\t"Vision of Perfection" : 296325,\n')
j.write('\t\t"Conflict" : 303823,\n')
j.write('\t\t"Concentrated Flame" : 295373,\n')
j.write('\t\t"Ripple in Space" : 302731,\n')
j.write('\t\t"Formless Void" : 313922,\n')
j.write('\t\t"Spark of Inspiration" : 311303,\n')
j.write('\t\t"Breath of the Dying" : 311195,\n')
#Special Majors
j.write('\t\t"Blood of the Enemy 100" : 297108,\n')
j.write('\t\t"Blood of the Enemy 75" : 297108,\n')
j.write('\t\t"Blood of the Enemy 50" : 297108,\n')
j.write('\t\t"Worldvein Resonance 4 Allies" : 295186,\n')
j.write('\t\t"Worldvein Resonance 3 Allies" : 295186,\n')
j.write('\t\t"Worldvein Resonance 2 Allies" : 295186,\n')
j.write('\t\t"Worldvein Resonance 1 Allies" : 295186,\n')
#Minors
j.write('\t\t"Blood-Soaked" : 297147,\n')
j.write('\t\t"Condensed Life-Force" : 295834,\n')
j.write('\t\t"Focused Energy" : 295246,\n')
j.write('\t\t"Purification Protocol" : 295293,\n')
j.write('\t\t"Reckless Force" : 298452,\n')
j.write('\t\t"Lucid Dreams" : 298268,\n')
j.write('\t\t"Strive for Perfection" : 296320,\n')
j.write('\t\t"Strife" : 304081,\n')
j.write('\t\t"Ancient Flame" : 295365,\n')
j.write('\t\t"Reality Shift" : 302916,\n')
j.write('\t\t"Symbiotic Presence" : 313920,\n')
j.write('\t\t"Unified Strength" : 311306,\n')
j.write('\t\t"Lethal Strikes" : 311198,\n')
#Special Minors
j.write('\t\t"Lifeblood 4 Allies" : 295078,\n')
j.write('\t\t"Lifeblood 3 Allies" : 295078,\n')
j.write('\t\t"Lifeblood 2 Allies" : 295078,\n')
j.write('\t\t"Lifeblood 1 Allies" : 295078\n')
j.write('\t},\n')
j.write('\t"simulated_steps" :[\n')
j.write('\t\t"rank_1",\n')
j.write('\t\t"rank_2",\n')
j.write('\t\t"rank_3"\n')
j.write('\t],\n')
j.write('\t"sorted_data_keys" : [\n')
DPSDict = dict()
for u in uniqueList:
totalDPS = 0
for x in data:
if x['profile'] == simType:
if x['actor'] == u+'1':
totalDPS += int(x['DPS'])
if x['actor'] == u+'2':
totalDPS += int(x['DPS'])
if x['actor'] == u+'3':
totalDPS += int(x['DPS'])
DPSDict.update({u.replace('_',' ').rstrip() : totalDPS})
for b in boteList:
totalDPS = 0
for x in data:
if x['profile'] == simType:
if x['actor'] == b+'_Uptime_1':
totalDPS += int(x['DPS'])
if x['actor'] == b+'_Uptime_2':
totalDPS += int(x['DPS'])
if x['actor'] == b+'_Uptime_3':
totalDPS += int(x['DPS'])
DPSDict.update({b.replace('_',' ').rstrip() : totalDPS})
for l in lifeBloodList:
totalDPS = 0
for x in data:
if x['profile'] == simType:
if x['actor'] == l + "_Allies_1":
totalDPS += int(x['DPS'])
if x['actor'] == l + "_Allies_2":
totalDPS += int(x['DPS'])
if x['actor'] == l + "_Allies_3":
totalDPS += int(x['DPS'])
name = l.replace('_',' ').rstrip() + ' Allies'
DPSDict.update({ name : totalDPS})
for w in worldVeinList:
totalDPS = 0
for x in data:
if x['profile'] == simType:
if x['actor'] == w + "_Allies_1":
totalDPS += int(x['DPS'])
if x['actor'] == w + "_Allies_2":
totalDPS += int(x['DPS'])
if x['actor'] == w + "_Allies_3":
totalDPS += int(x['DPS'])
name = w.replace('_',' ').rstrip() + ' Allies'
DPSDict.update({ name : totalDPS})
cnt=0
maxCnt = len(DPSDict)
import operator
sorted_x = sorted(DPSDict.items(), key=lambda kv: kv[1], reverse=True)
for key in sorted_x:
cnt+=1
if cnt < maxCnt:
j.write('\t\t "' + key[0] + '",\n')
else:
j.write('\t\t "' + key[0] + '"\n')
j.write('\t]\n')
j.write('}')
def buildCorruptionJsonChart(injsonFile, outjsonFile, simType, points):
'''
injsonFile - The original CSV data converted to a raw unformatted JSON
outjsonFile - The newly formatted JSON
simType - Composite, Single Target, Dungeons
'''
#trinketnames = getNames(injsonFile) #Get all the trinket names from the inputted JSON file
namelist = list()
j = open(outjsonFile,'w') #Start writing our JSON file
j.write('{\n') #JSON formatting
with open(injsonFile,'r') as f: #Start reading the inputted JSON file.
data = json.load(f)
for x in data: #Easier to parse the originally converted JSON to organize the data
m = re.search(r"\D*",x['actor'].rstrip()).group(0)
namelist.append(m)
uniqueList = make_unique(namelist)
'''
injsonFile - The original CSV data converted to a raw unformatted JSON
outjsonFile - The newly formatted JSON
simType - Composite, Single Target, Dungeons
'''
namelist = list()
j = open(outjsonFile,'w') #Start writing our JSON file
j.write('{\n') #JSON formatting
with open(injsonFile,'r') as f: #Start reading the inputted JSON file.
data = json.load(f)
for x in data: #Easier to parse the originally converted JSON to organize the data