@blizzhackers/d2data 2.7.12 → 2.7.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/compile.js CHANGED
@@ -639,11 +639,29 @@ let dmgtypes = [
639
639
  'ResPo',
640
640
  ];
641
641
 
642
+ let progressionAreas = [ // Areas that we're forced to deal with while progressing through the main quest lines.
643
+ // Act 1
644
+ 2,3,4,5,6,7,10,26,27,28,29,30,31,32,33,34,35,36,
645
+ // Act 2
646
+ 41,42,43,44,45,46,50,51,52,53,54,56,57,58,60,61,62,63,64,66,67,68,69,70,71,72,73,
647
+ // Act 3
648
+ 76,77,78,79,80,81,82,83,85,88,89,91,92,93,100,101,
649
+ // Act 4
650
+ 104,105,106,107,
651
+ // Act 5
652
+ 110,111,112,113,115,117,118,120,128,129,130,
653
+ ];
654
+
655
+ let bossAreas = [ // Areas that we're forced to deal with for boss farming.
656
+ 37,74,102,108,131,132,
657
+ ];
658
+
642
659
  for (let diff of [0, 1, 2]) {
643
660
  let s = str => str + ['', '(N)', '(H)'][diff];
644
- let diffstr = ['normal', 'nightmare', 'hell'][diff];
645
661
 
646
662
  for (let levelid in monpopulation) {
663
+ levelid = Number(levelid);
664
+
647
665
  let level = full.levels[levelid];
648
666
  let act = (level.Act || 0);
649
667
  let pop = monpopulation[levelid];
@@ -652,6 +670,8 @@ for (let diff of [0, 1, 2]) {
652
670
  continue;
653
671
  }
654
672
 
673
+ let category = bossAreas.indexOf(levelid) >= 0 ? 'boss' : (progressionAreas.indexOf(levelid) >= 0 ? 'progression' : 'optional');
674
+
655
675
  for (let montype of montypes) {
656
676
  for (let id in pop[montype]) {
657
677
  let sup = undefined,
@@ -681,15 +701,16 @@ for (let diff of [0, 1, 2]) {
681
701
  }
682
702
 
683
703
  actprofile[act] = actprofile[act] || {};
704
+ actprofile[act][category] = actprofile[act][category] || {};
684
705
 
685
706
  for (let dmgtype of dmgtypes) {
686
- actprofile[act][s(dmgtype)] = actprofile[act][s(dmgtype)] || {};
707
+ actprofile[act][category][s(dmgtype)] = actprofile[act][category][s(dmgtype)] || {};
687
708
  }
688
709
 
689
710
  for (let dmgtype of dmgtypes) {
690
711
  let resist = mon[s(dmgtype)] || 0;
691
712
 
692
- actprofile[act][s(dmgtype)][resist] = actprofile[act][s(dmgtype)][resist] || 0;
713
+ actprofile[act][category][s(dmgtype)][resist] = actprofile[act][category][s(dmgtype)][resist] || 0;
693
714
 
694
715
  if (montype === 'superunique' || montype === 'unique') {
695
716
  if (montype === 'superunique') {
@@ -698,14 +719,14 @@ for (let diff of [0, 1, 2]) {
698
719
  else {
699
720
  grp = Math.max(1, ((mon['MinGrp'] || 1) + (mon['MaxGrp'] || 1)) / 2);
700
721
  }
701
- actprofile[act][s(dmgtype)][resist] += packCount * hp * [4, 3, 2][diff];
722
+ actprofile[act][category][s(dmgtype)][resist] += packCount * hp * [4, 3, 2][diff];
702
723
  party = 2.5 + diff;
703
724
  }
704
725
  else if (montype === 'champion') {
705
- actprofile[act][s(dmgtype)][resist] += packCount * hp * 3 * [3, 2.5, 2][diff];
726
+ actprofile[act][category][s(dmgtype)][resist] += packCount * hp * 3 * [3, 2.5, 2][diff];
706
727
  }
707
728
  else {
708
- actprofile[act][s(dmgtype)][resist] += packCount * hp * grp;
729
+ actprofile[act][category][s(dmgtype)][resist] += packCount * hp * grp;
709
730
  }
710
731
 
711
732
  if (party > 0 && minions.length > 0) {
@@ -716,8 +737,8 @@ for (let diff of [0, 1, 2]) {
716
737
  mhp = full.monlvl[mmlvl][s('HP')] *
717
738
  (mmon[['minHP', 'MinHP(N)', 'MinHP(H)'][diff]] + mmon[['maxHP', 'MaxHP(N)', 'MaxHP(H)'][diff]]) / 100;
718
739
 
719
- actprofile[act][s(dmgtype)][mresist] = actprofile[act][s(dmgtype)][mresist] || 0;
720
- actprofile[act][s(dmgtype)][mresist] += packCount * mhp * party / minions.length;
740
+ actprofile[act][category][s(dmgtype)][mresist] = actprofile[act][category][s(dmgtype)][mresist] || 0;
741
+ actprofile[act][category][s(dmgtype)][mresist] += packCount * mhp * party / minions.length;
721
742
  }
722
743
  }
723
744
  }
@@ -726,13 +747,16 @@ for (let diff of [0, 1, 2]) {
726
747
  }
727
748
  }
728
749
 
729
- for (let act in actprofile) {
730
- for (let dmgtype in actprofile[act]) {
731
- for (let resist in actprofile[act][dmgtype]) {
732
- actprofile[act][dmgtype][resist] = Math.round(actprofile[act][dmgtype][resist]);
750
+ (function roundValues (obj) {
751
+ for (let key in obj) {
752
+ if (typeof obj[key] === 'number') {
753
+ obj[key] = Math.round(obj[key]);
754
+ }
755
+ else if(typeof obj[key] === 'object') {
756
+ roundValues(obj[key]);
733
757
  }
734
758
  }
735
- }
759
+ })(actprofile);
736
760
 
737
761
  let tcprecalc = {};
738
762