Exemple #1
0
 function createClassObject($characterPage)
 {
     $class = DPClassFactory::findClass($characterPage);
     include_once __DIR__ . "/{$class}.php";
     switch ($class) {
         case 'barbarian':
             return new Barbarian($characterPage);
         case 'wizard':
             return new Wizard($characterPage);
         default:
             return false;
     }
 }
Exemple #2
0
<?php

include_once __DIR__ . '/libs/dpclass.php';
if ($_POST['submit']) {
    $diabloProgressUrl = trim($_POST['url']);
    if (preg_match('{^http://www.diabloprogress.com/hero/[\\w]+\\-[\\d]+/[\\w]+/[\\d]+$}', $diabloProgressUrl) != 1) {
        die('Bad URL.  Please enter the entire diablo progress URL.<br/><br/>Example: http://www.diabloprogress.com/hero/celanian-1548/HsuMing/21706367');
    }
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $diabloProgressUrl);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    $contents = curl_exec($curl);
    curl_close($curl);
    $character = DPClassFactory::createClassObject($contents);
    if ($character === FALSE) {
        die('Bad class.  Either your class could not be detected or we do not support your class at this time.');
    }
    ?>
<hr/>
<b>Hall Score: <?php 
    echo round($character->hallScore(), 2);
    ?>
</b><br/><br/>

DPS Score: <?php 
    echo round($character->DPSScore(), 2);
    ?>
<br/>
EHP Score: <?php