
You are viewing a potentially older version of this package. View Latest Version

Have fun!
StatsMod ClassModName: Name of the mod for indentifying and organizing data files.storeEntryTime: Boolean value to include timestamps for each entry.DebugMode: Boolean value to enable debug mode (logging to console).InitializeStatFile
fileName: Name of the CSV file.columns: Dictionary (string, type) of column names and their data types.var columns = new Dictionary<string, Type>
{
{ "Player Name", typeof(string) },
{ "Battle Points", typeof(int) }
};
mod.InitializeStatFile("PlayerStats", columns);
StatFileExists
true if the file exists, otherwise false.GetAllRows
csvFileName: The name of the file to read.skipHeader: Boolean value to skip the header row.AddStatRow
values: Array of object values for the row. Make sure they match the column types defined in the CSV file, in the same order, and the same amount of values.csvFileName: The name of the file to add the row to.mod.AddStatRow(new object[] {
"Player1",
100
}, "PlayerStats");
FormatValue
AddStatRow method.Main ClassRegisterCSVFile
csvFileName: The name of the CSV file to register.using MelonLoader;
using RumbleStats;
//other references...
namespace MyMod
{
public class Main : MelonMod
{
StatsMod mod = new StatsMod();
public override void OnLateInitializeMelon()
{
mod.ModName = "MyModName";
mod.storeEntryTime = true; //Stores entry timestamps when calling AddStatRow
mod.storeEntryTime = false; //Does not store entry timestamps when calling AddStatRow
var columns = new Dictionary<string, Type>
{
{ "Column1Name", typeof(string) },
{ "Column2Name", typeof(int) },
{ "Column3Name", typeof(bool) },
//etc...
};
mod.InitializeStatFile("CSVFileName", columns);
RumbleStats.Main.instance.RegisterCSVFile("CSVFileName");
RumbleStats.Main.instance.RegisterMod(mod);
//Do this for each CSV file you want to store stats for...
}
private void SomeRandomMethod()
{
mod.AddStatRow(new object[]
{
"Stat1",
1000101,
true,
//etc, same as the columns provided in the InitializeStatFile method...
}, "CSVFileName");
var rows = mod.GetAllRows("CSVFileName", skipHeader: true);
foreach (var row in rows)
{
MelonLogger.Msg(string.Join(", ", row));
}
}
}
}