Add Diablo To Games

Add calls to the Diablo 3 API to gather information from their "career"
api and display the information on the index page.

Also hid HTML from the main page that is no longer updated.
This commit is contained in:
Andrew Tomaka 2012-09-12 08:57:08 -04:00
parent a1c0043c73
commit fb061e0b24
4 changed files with 49 additions and 13 deletions

View file

@ -25,11 +25,11 @@ define('LOCK',$conf->site->path . '/data/whoisandrew.lock');
$dataSources = array(
'twitter' => 300,
'github' => 300,
'hulu' => 600,
'lastfm' => 60,
// 'sc2ranks' => 43200,
'steam' => 3600,
'wow' => 43200,
'wow' => 43200,
'diablo' => 43200,
);
// Make sure that the script does not begin execution if it is already.
@ -239,11 +239,33 @@ function steam() {
}
}
function diablo() {
$url = 'http://us.battle.net//api/d3/profile/Tomaka-1761/';
$career = json_decode(curl_request($url));
// cheat and just use information from barbarian
$barb = $career->heroes[0];
$data = array(
'hardcoreFails' => (int)count($career->fallenHeroes),
'highestParagon' => (int)$barb->paragonLevel,
'monsters' => (int)$career->kills->monsters,
'elites' => (int)$career->kills->elites,
'hardcoreMonsters'=> (int)$career->kills->hardcoreMonsters,
);
if(isset($data['hardcoreFails'])&&isset($data['highestParagon'])&&isset($data['monsters'])&&isset($data['elites'])&&isset($data['hardcoreMonsters'])) {
return $data;
} else {
return false;
}
}
function wow() {
$CLASSES = array(
6 => 'deathknight',
5 => 'priest',
11 => 'druid',
11 => 'druid',
4 => 'rogue',
8 => 'mage',
7 => 'shaman',
@ -253,12 +275,12 @@ function wow() {
);
$characters = array(
'Gaffer' => false,
'Gaffer' => false,
'Getburnt' => false,
'Veincane' => false,
'Toppazz' => false,
'Toopro' => false,
'Levita' => false,
'Toppazz' => false,
'Toopro' => false,
'Levita' => false,
'Trinikwan' => false,
'Notgaffer' => false,
'Loveglove' => false,

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

View file

@ -47,10 +47,10 @@ $links = $db->query("SELECT id,url,text,status,released_date FROM wia_links WHER
</div>
<br/>
<h2>projects</h2>
<!--<h2>projects</h2>
<h3>project 1</h3>
<div id="projects">
<!--<div id ="tomtvgrid" class="box">
<div id ="tomtvgrid" class="box">
<table class="formatting">
<tr>
<td class="top">
@ -62,8 +62,8 @@ $links = $db->query("SELECT id,url,text,status,released_date FROM wia_links WHER
</td>
</tr>
</table>
</div>-->
</div>
</div>
</div>-->
</div>
<div id="column1">
<h2>random</h2>
@ -97,7 +97,7 @@ while($link = $links->fetch_object()) {
</tr>
</table>
</div>
<div id="hulu" class="box">
<!--<div id="hulu" class="box">
<table class="formatting">
<tr>
<td class="formatting">
@ -111,7 +111,7 @@ while($link = $links->fetch_object()) {
</td>
</tr>
</table>
</div>
</div>-->
<br/>
<h2>games</h2>
<h3>World of Warcraft</h3>
@ -140,7 +140,21 @@ foreach($data->wow as $character) {
</tr>
</table>
</div>
<h3>Diablo 3</h3>
<h3>Starcraft 2</h3>
<div id="sc2" class="box">
<table class="formatting">
<tr>
<td class="gamesformatting"><a href="http://battle.net/d3"><img src="img/badges/diablo3.png" alt="Diablo 3" /></a></td>
<td class="top">
<a href="http://us.battle.net/d3/en/profile/Tomaka-1761/">Tomaka#1761</a><br/>
Paragon: <?php echo $data->diablo->highestParagon ?><br/>
Elite Kills: <?php echo $data->diablo->elites ?>
</td>
<td class="right,top"><img src="img/d3/barbarian.jpg" alt="<?php echo ucfirst($data->sc2ranks->league) ?> League" /></td>
</tr>
</table>
</div>
<div id="sc2" class="box">
<table class="formatting">
<tr>