public static void TraceInternal_OnCommand( CommandEventArgs e )
{
int totalCount = 0;
Hashtable table = new Hashtable();
foreach ( Item item in World.Items.Values )
{
if ( item.Parent != null || item.Map != Map.Internal )
continue;
++totalCount;
Type type = item.GetType();
int[] parms = (int[])table[type];
if ( parms == null )
table[type] = parms = new int[]{ 0, 0 };
parms[0]++;
parms[1] += item.Amount;
}
using ( StreamWriter op = new StreamWriter( "internal.log" ) )
{
op.WriteLine( "# {0} items found", totalCount );
op.WriteLine( "# {0} different types", table.Count );
op.WriteLine();
op.WriteLine();
op.WriteLine( "Type\t\tCount\t\tAmount\t\tAvg. Amount" );
foreach ( DictionaryEntry de in table )
{
Type type = (Type)de.Key;
int[] parms = (int[])de.Value;
op.WriteLine( "{0}\t\t{1}\t\t{2}\t\t{3:F2}", type.Name, parms[0], parms[1], (double)parms[1] / parms[0] );
}
}
}