Quote:
Originally Posted by Pinski
Anyway you'd be willing to part with your code to allow others to host their own site and/or tweak the code to their own liking?
|
I got a little frustrated with screen shotting parses for posting today so here's part of my solution.
Assuming that you can grok the included MySQL PHP Templates in ACT that Aditu was so kind to provide and that you grok how to do ODBC exports to MySQL, I stumbled across a simple (and free) graphing solution for making parses pretty. Like this (names changed to Anon to protect the innocent!):
The graphing package used is available here:
PHPGraphLib Lightweight PHP Graphing Library
The files should be extracted in the same location as the sample ACT files (or you'll need to change the path). A new file should be created named combatant_graph.php (for consistency, though truly, the name doesn't matter). The combatant_graph.php creates a png image, so in order to display it, you need to use image tags. In other words, if you wanted it to show here:
HTML Code:
[img]http://www.yoursite.com/path/to/ACT/files/combatant_graph.php[/img]
Note that the above will simply graph the latest parse in your database. In order to do a specific encounter with a restricted number of particpants, it would be something like:
HTML Code:
[img]http://www.yoursite.com/path/to/ACT/files/combatant_graph.php?encid=12345678&count=6[/img]
The file is set up to grab and graph the latest exported parse if you don't specify an encounter ID (encid). The encid is the same that ACT uses.
The actual content of the file (combatant_graph.php) that generates the image:
PHP Code:
<?php
include 'actdb.php';
include 'phpgraphlib.php';
//If encid is not specified, get latest encounter.
if(!isset($_GET['encid']))
{
$query = "SELECT encid FROM encounter_table ORDER BY endtime DESC LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$encid = $row[0];
}
else
$encid = mysql_real_escape_string( $_GET['encid'] );
//count is number of people to be graphed. Usually doesn't need to be used unless there are oddities with ally detection.
if(!isset($_GET['count']))
$count = 24;
else
$count = mysql_real_escape_string( $_GET['count'] );
$query = "SELECT name,extdps,exthps FROM combatant_table WHERE encid = '$encid' AND ally = 'T'";
$query .= " ORDER BY extdps + exthps DESC";
$query .= " LIMIT $count";
$result = mysql_query($query);
$data = array();
$data2 = array();
$data3 = array();
while($row = mysql_fetch_row($result))
{
$name = $row[0];
$extdps = $row[1];
$exthps = $row[2];
$data[$name] = $extdps;
$data2[$name] = $exthps;
$data3[$name] = $exthps + $extdps;
}
$query = "SELECT title,starttime FROM encounter_table WHERE encid = '$encid' LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$title = $row[0] . " " . substr($row[1],0,10);
$graph = new PHPGraphLib(800,300);
$graph->addData($data,$data2,$data3);
$graph->setTitle($title);
$graph->setTitleColor("white");
$graph->setupXAxis(28,"white");
$graph->setupyAxis("","white");
$graph->setGradient("200,0,0", "100,0,0", "0,200,0", "0,100,0", "64,64,64", "black");
$graph->setBarOutline(false);
$graph->setBackgroundColor("122,119,114");
$graph->setTextColor("white");
$graph->setLegend(true);
$graph->setLegendTitle("Damage", "Healed", "Total");
$graph->setLegendColor("114,122,122");
$graph->setLegendTextColor("white");
$graph->createGraph();
?>
I'll probably clean this up a bit more over the next few days, if anyone is interested or needs a feature or what have you.