(.*?)<\/span><\/nobr><\/div>}', $this->dpHTML, $attributes);
-
- for($i = 0; $i < count($attributes[0]); $i++) {
- $attributes[2][$i] = str_replace(',', '', $attributes[2][$i]);
- if(preg_match('/%/', $attributes[2][$i]) > 0) {
- $attributes[2][$i] = str_replace('%', '', $attributes[2][$i]);
- $attributes[2][$i] /= 100;
- }
- $this->stats[$attributes[1][$i]] = $attributes[2][$i];
- }
-
- $this->stats['Gem Life'] = $this->calculateGemLife();
- $this->modifyExpBonus();
-
- $this->stats['All Elemental Damage'] = $this->elementalDamage();
-
- $this->modifyDPSUnbuffed();
- $this->modifyEHP();
- $this->modifyHP();
- }
-
- function elementalDamage() {
- $totalElemental = 1;
- foreach($this->stats as $stat => $value) {
- if(preg_match('/\+DPS \(.*\)/', $stat) > 0) {
- $totalElemental += $value;
- }
- }
-
- if($this->elementalOnWeapon && $totalElemental != 1) {
- $totalElemental *= .5;
- }
-
- return ($totalElemental > 0) ? $totalElemental : 0;
- }
-
- function calculateGemLife() {
- if($this->isParagonMaxed()) return 0;
-
- switch($this->getStat('Exp Bonus')) {
- case .19: return .12;
- case .21: return .14;
- case .25: return .15;
- case .27: return .16;
- case .29: return .17;
- case .31: return .18;
- default: return 0;
- }
- }
-
- function modifyExpBonus() {
- if($this->getStat('Exp Bonus') >= .35) {
- $this->stats['Exp Bonus'] = $this->getStat('Exp Bonus') - .35;
- }
- }
-
- function modifyDPSUnbuffed() {
- $this->stats['DPS Unbuffed'] = $this->getStat('DPS Unbuffed') *
- $this->getStat('All Elemental Damage') *
- max(1, 1 + ($this->getStat('+DPS Against Elites') / 2));
- }
-
- function modifyEHP() {
- $this->stats['EHP Unbuffed'] = $this->getStat('EHP Unbuffed') *
- (1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) /
- (1 + $this->getStat('Life Bonus'));
- }
-
- function modifyHP() {
- $this->stats['Life'] = $this->getStat('Life') *
- (1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) /
- (1 + $this->getStat('Life Bonus'));
- }
-
- function isParagonMaxed() {
- return $this->getStat('Paragon Level') == 100;
- }
-
function hallScore() {
return $this->DPSScore() * $this->EHPScore() * $this->sustainScore()
* $this->moveScore() * $this->paragonScore();
@@ -171,7 +92,88 @@ class DPClass {
return 1 + $this->stats['Paragon Level'] / 2 / 100;
}
- function getStat($name) {
- return (isset($this->stats[$name])) ? $this->stats[$name] : 0;
- }
+ protected
+ function isParagonMaxed() {
+ return $this->getStat('Paragon Level') == 100;
+ }
+
+ function getStat($name) {
+ return (isset($this->stats[$name])) ? $this->stats[$name] : 0;
+ }
+
+ private
+ function parseStats() {
+ preg_match_all('{(.*?):<\/span> (.*?)<\/span><\/nobr><\/div>}', $this->dpHTML, $attributes);
+
+ for($i = 0; $i < count($attributes[0]); $i++) {
+ $attributes[2][$i] = str_replace(',', '', $attributes[2][$i]);
+ if(preg_match('/%/', $attributes[2][$i]) > 0) {
+ $attributes[2][$i] = str_replace('%', '', $attributes[2][$i]);
+ $attributes[2][$i] /= 100;
+ }
+ $this->stats[$attributes[1][$i]] = $attributes[2][$i];
+ }
+
+ $this->stats['Gem Life'] = $this->calculateGemLife();
+ $this->modifyExpBonus();
+
+ $this->stats['All Elemental Damage'] = $this->elementalDamage();
+
+ $this->modifyDPSUnbuffed();
+ $this->modifyEHP();
+ $this->modifyHP();
+ }
+
+ function elementalDamage() {
+ $totalElemental = 1;
+ foreach($this->stats as $stat => $value) {
+ if(preg_match('/\+DPS \(.*\)/', $stat) > 0) {
+ $totalElemental += $value;
+ }
+ }
+
+ if($this->elementalOnWeapon && $totalElemental != 1) {
+ $totalElemental *= .5;
+ }
+
+ return ($totalElemental > 0) ? $totalElemental : 0;
+ }
+
+ function calculateGemLife() {
+ if($this->isParagonMaxed()) return 0;
+
+ switch($this->getStat('Exp Bonus')) {
+ case .19: return .12;
+ case .21: return .14;
+ case .25: return .15;
+ case .27: return .16;
+ case .29: return .17;
+ case .31: return .18;
+ default: return 0;
+ }
+ }
+
+ function modifyExpBonus() {
+ if($this->getStat('Exp Bonus') >= .35) {
+ $this->stats['Exp Bonus'] = $this->getStat('Exp Bonus') - .35;
+ }
+ }
+
+ function modifyDPSUnbuffed() {
+ $this->stats['DPS Unbuffed'] = $this->getStat('DPS Unbuffed') *
+ $this->getStat('All Elemental Damage') *
+ max(1, 1 + ($this->getStat('+DPS Against Elites') / 2));
+ }
+
+ function modifyEHP() {
+ $this->stats['EHP Unbuffed'] = $this->getStat('EHP Unbuffed') *
+ (1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) /
+ (1 + $this->getStat('Life Bonus'));
+ }
+
+ function modifyHP() {
+ $this->stats['Life'] = $this->getStat('Life') *
+ (1 + $this->getStat('Life Bonus') + $this->getStat('Gem Life')) /
+ (1 + $this->getStat('Life Bonus'));
+ }
}