Rinn
Developer
This might be information worth adding to the proxy field for items, if a good way to keep the data up to date without hitting "showconsumption.php?recent=1" after every consume is added.
Code:
record consumption_data {
int count;
string date;
};
consumption_data [ item ] consumption_history;
void load_history()
{
buffer page = visit_url( "showconsumption.php?recent=1" );
// <a class=nounder href='javascript:descitem\(\d+?\);'>(.+?)</a> </td><td>(.+?)</td><td nowrap><small>(.+?)</small>
matcher m = create_matcher( "<a class=nounder href='javascript:descitem\\(\\d+?\\);'>(.+?)</a> </td><td>(.+?)</td><td nowrap><small>(.+?)</small>", page );
while ( m.find() )
{
item i = m.group( 1 ).to_item();
consumption_history[ i ].count = m.group( 2 ).to_int();
consumption_history[ i ].date = m.group( 3 );
}
}
load_history();
void main()
{
foreach i in consumption_history
{
print( i + ": " + consumption_history[ i ].count + " - " + consumption_history[ i ].date );
}
}