@blizzhackers/d2data 2.7.12 → 2.7.13

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,25 @@ let dmgtypes = [
639
639
  'ResPo',
640
640
  ];
641
641
 
642
+ let requiredAreas = [ // Areas that we're forced to deal with through questing.
643
+ // Act 1
644
+ 2,3,4,5,6,7,10,26,27,28,29,30,31,32,33,34,35,36,37,
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,74,
647
+ // Act 3
648
+ 76,77,78,79,80,81,82,83,85,88,89,91,92,93,100,101,102,
649
+ // Act 4
650
+ 104,105,106,107,108,
651
+ // Act 5
652
+ 110,111,112,113,115,117,118,120,128,129,130,131,132
653
+ ];
654
+
642
655
  for (let diff of [0, 1, 2]) {
643
656
  let s = str => str + ['', '(N)', '(H)'][diff];
644
- let diffstr = ['normal', 'nightmare', 'hell'][diff];
645
657
 
646
658
  for (let levelid in monpopulation) {
659
+ levelid = Number(levelid);
660
+
647
661
  let level = full.levels[levelid];
648
662
  let act = (level.Act || 0);
649
663
  let pop = monpopulation[levelid];
@@ -652,6 +666,8 @@ for (let diff of [0, 1, 2]) {
652
666
  continue;
653
667
  }
654
668
 
669
+ let category = requiredAreas.indexOf(levelid) >= 0 ? 'required' : 'optional';
670
+
655
671
  for (let montype of montypes) {
656
672
  for (let id in pop[montype]) {
657
673
  let sup = undefined,
@@ -681,15 +697,16 @@ for (let diff of [0, 1, 2]) {
681
697
  }
682
698
 
683
699
  actprofile[act] = actprofile[act] || {};
700
+ actprofile[act][category] = actprofile[act][category] || {};
684
701
 
685
702
  for (let dmgtype of dmgtypes) {
686
- actprofile[act][s(dmgtype)] = actprofile[act][s(dmgtype)] || {};
703
+ actprofile[act][category][s(dmgtype)] = actprofile[act][category][s(dmgtype)] || {};
687
704
  }
688
705
 
689
706
  for (let dmgtype of dmgtypes) {
690
707
  let resist = mon[s(dmgtype)] || 0;
691
708
 
692
- actprofile[act][s(dmgtype)][resist] = actprofile[act][s(dmgtype)][resist] || 0;
709
+ actprofile[act][category][s(dmgtype)][resist] = actprofile[act][category][s(dmgtype)][resist] || 0;
693
710
 
694
711
  if (montype === 'superunique' || montype === 'unique') {
695
712
  if (montype === 'superunique') {
@@ -698,14 +715,14 @@ for (let diff of [0, 1, 2]) {
698
715
  else {
699
716
  grp = Math.max(1, ((mon['MinGrp'] || 1) + (mon['MaxGrp'] || 1)) / 2);
700
717
  }
701
- actprofile[act][s(dmgtype)][resist] += packCount * hp * [4, 3, 2][diff];
718
+ actprofile[act][category][s(dmgtype)][resist] += packCount * hp * [4, 3, 2][diff];
702
719
  party = 2.5 + diff;
703
720
  }
704
721
  else if (montype === 'champion') {
705
- actprofile[act][s(dmgtype)][resist] += packCount * hp * 3 * [3, 2.5, 2][diff];
722
+ actprofile[act][category][s(dmgtype)][resist] += packCount * hp * 3 * [3, 2.5, 2][diff];
706
723
  }
707
724
  else {
708
- actprofile[act][s(dmgtype)][resist] += packCount * hp * grp;
725
+ actprofile[act][category][s(dmgtype)][resist] += packCount * hp * grp;
709
726
  }
710
727
 
711
728
  if (party > 0 && minions.length > 0) {
@@ -716,8 +733,8 @@ for (let diff of [0, 1, 2]) {
716
733
  mhp = full.monlvl[mmlvl][s('HP')] *
717
734
  (mmon[['minHP', 'MinHP(N)', 'MinHP(H)'][diff]] + mmon[['maxHP', 'MaxHP(N)', 'MaxHP(H)'][diff]]) / 100;
718
735
 
719
- actprofile[act][s(dmgtype)][mresist] = actprofile[act][s(dmgtype)][mresist] || 0;
720
- actprofile[act][s(dmgtype)][mresist] += packCount * mhp * party / minions.length;
736
+ actprofile[act][category][s(dmgtype)][mresist] = actprofile[act][category][s(dmgtype)][mresist] || 0;
737
+ actprofile[act][category][s(dmgtype)][mresist] += packCount * mhp * party / minions.length;
721
738
  }
722
739
  }
723
740
  }
@@ -726,13 +743,16 @@ for (let diff of [0, 1, 2]) {
726
743
  }
727
744
  }
728
745
 
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]);
746
+ (function roundValues (obj) {
747
+ for (let key in obj) {
748
+ if (typeof obj[key] === 'number') {
749
+ obj[key] = Math.round(obj[key]);
750
+ }
751
+ else if(typeof obj[key] === 'object') {
752
+ roundValues(obj[key]);
733
753
  }
734
754
  }
735
- }
755
+ })(actprofile);
736
756
 
737
757
  let tcprecalc = {};
738
758