00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #define MECH_STAT_C
00016 #include "mech.stat.h"
00017 #include "db.h"
00018 #include "externs.h"
00019
00020 stat_type rollstat;
00021
00022 void init_stat()
00023 {
00024
00025
00026 }
00027
00028 static int chances[11] = { 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 };
00029
00030 void do_show_stat(dbref player, dbref cause, int key, char *arg1, char *arg2)
00031 {
00032 int i;
00033 float f1, f2;
00034
00035 if(!rollstat.totrolls) {
00036 notify(player, "No rolls to show statistics for!");
00037 return;
00038 }
00039 for(i = 0; i < 11; i++) {
00040 if(i == 0) {
00041 notify(player, "# Rolls Optimal% Present% Diff. in 1000");
00042 }
00043 f1 = (float) chances[i] * 100.0 / 36.0;
00044 f2 = (float) rollstat.rolls[i] * 100.0 / rollstat.totrolls;
00045 notify_printf(player, "%-3d %6d %8.3f %8.3f %.3f", i + 2,
00046 rollstat.rolls[i], f1, f2, 10.0 * f2 - 10.0 * f1);
00047 }
00048 notify_printf(player, "Total rolls: %d", rollstat.totrolls);
00049 }