- Code: Select all
<?
define('ROSTER_INSTALLED', true);
include('./luaparser.php');
If ($data = ParseLuaFile('./Auctioneer.lua'))
{
unset($data['AuctionConfig']);
unset($data['AuctioneerSnapshotDB']);
unset($data['AuctioneerFixedPriceDB']);
unset($data['AuctioneerTransactionDB']);
unset($data['AuctioneerItemDB']['version']);
unset($data['AuctioneerItemDB']['auctionItemSubClasses']);
unset($data['AuctioneerItemDB']['textures']);
unset($data['AuctioneerItemDB']['auctionItemClasses']);
unset($data['AuctioneerItemDB']['inventoryTypes']);
foreach ($data['AuctioneerHistoryDB'] as $realm => $x)
{
if ($realm != 'altar of storms-horde')
{
unset($data['AuctioneerHistoryDB']["$realm"]);
}
}
//parse each item
foreach ($data['AuctioneerHistoryDB']['altar of storms-horde']['buyoutPrices'] as $id => $history)
{
$values = explode(':', $history);
foreach ($values as &$amount)
{
$amount2 = explode('x', $amount);
if ($amount2[0] != $amount)
{
$amount = $amount2[0] / $amount2[1];
}
}
sort($values);
$num = count($values);
if ($num%2 == 0)
{
$middle = $num/2;
$market = ($values[$middle] + $values[$middle - 1]) / 2;
}
else
{
$market = $values[$num/2];
}
$gold = floor($market / 10000);
$silver = floor(($market - $gold * 10000) / 100);
$copper = floor($market - $gold * 10000 - $silver * 100);
$itemdb = explode(';', $data['AuctioneerItemDB']['items'][$id]);
$name = $itemdb[0];
echo $name . ' => Market value = ' . $gold . 'g ' . $silver . 's ' . $copper . 'c<br />';
}
}
else
{
echo "error opening file";
}
?>
NOTE: This only parses the history and has the realm and faction hardcoded.