Quote:
Originally Posted by BarBeQue
Boofo, any news on how to add the arcade stats to your hack?
Would love to have those added 
|
Ok, for those of you who have John's Excellent vB3 Arcade hack installed, here's a treat!
This addon will add a line to your Forumhome Stats to Display the Most Played Game (with a link directly to that game), the highest scorer in that game (the Champion) and his score.
Here we go!
In index.php, find:
PHP Code:
// <!-- TOP REPUTATION -->
$toprep = $DB_site->query_first("
SELECT userid, username, reputation
FROM " . TABLE_PREFIX . "user
ORDER BY reputation
DESC LIMIT 1
");
BELOW it add:
PHP Code:
// <!-- TOP ARCADE GAME -->
$mostactive = $DB_site->query_first("
SELECT COUNT(*) as total, gamesessions.gamename, games.title, games.gameid, MAX(gamesessions.score) as score, user.username, user.userid
FROM ".TABLE_PREFIX."gamesessions
INNER JOIN " . TABLE_PREFIX . "games AS games ON(gamesessions.gamename = games.shortname)
INNER JOIN " . TABLE_PREFIX . "user AS user ON(games.highscorerid = user.userid)
WHERE gamesessions.valid=1
GROUP BY gamesessions.gamename
ORDER BY total
DESC LIMIT 0,1
");
Find:
PHP Code:
$statscache['lastupdate'] = intval (TIMENOW);
ABOVE it add:
PHP Code:
$statscache['mostactivetotal'] = intval ($mostactive[total]);
$statscache['mostactivegamen'] = $mostactive[gamename];
$statscache['mostactivetitle'] = $mostactive[title];
$statscache['mostactivegameid'] = intval ($mostactive[gameid]);
$statscache['mostactivescore'] = intval ($mostactive[score]);
$statscache['mostactiveun'] = $mostactive[username];
$statscache['mostactiveid'] = intval ($mostactive[userid]);
Find:
PHP Code:
$statscache['topreprep'] = vb_number_format($statscache['topreprep']);
BELOW it add:
PHP Code:
$statscache['mostactivetotal'] = vb_number_format($statscache['mostactivetotal']);
$statscache['mostactivescore'] = vb_number_format($statscache['mostactivescore']);
Save and upload.
In the forumhome template, find:
HTML Code:
<if condition="$show['reputation']">
<tr>
<td nowrap="nowrap"><span class="smallfont">Top Reputation: <a href="member.php?$session[sessionurl]u=$statscache[toprepid]">$statscache[toprepun]</a> (<b>$statscache[topreprep]</b> Reputation Points)</span></td>
</tr>
</if>
BELOW it add:
HTML Code:
<tr>
<td nowrap="nowrap"><span class="smallfont">Most Active Arcade Game: <a href="$vboptions[bburl]/arcade.php?do=play&gameid=$statscache[mostactivegameid]">$statscache[mostactivetitle]</a> (<b>$statscache[mostactivetotal]</b> Total Plays -- Champion: <a href="member.php?$session[sessionurl]u=$statscache[mostactiveid]">$statscache[mostactiveun]</a> with <b>$statscache[mostactivescore]</b> Points)</span></td>
</tr>
Save the template.
NOTE: Don't forget to set the update time to 0 and refresh the page so the cache can get updated with the new stats. And don't forget to set it back to what you had it set at after updating the cache.
You're done!
Enjoy!