public static void saveShippedItems(string statsFolderPath, string playerName, string farmName, List <ItemTrack> trackedItems, int year, int month, int day) { //adjust for month transition if (day == 0) { day = 28; month--; if (month == -1) { month = 3; year--; } } String statsFilePath = statsFolderPath + playerName + " Track Stats.csv"; MainModClass.Log("Saving stats for " + trackedItems.Count + " items for day " + day + " of the " + month + " season of year " + year + " to the file " + statsFilePath); StringBuilder csv = new StringBuilder(); if (!File.Exists(statsFilePath)) { addHeaderLine(csv, playerName, farmName); } csv.Append(year + "," + month + "," + day); foreach (ItemTrack item in trackedItems) { csv.Append("," + item.getID() + "," + item.getCount() + "," + item.getPrice() + "," + item.getCategory() + "," + item.getParentSheetIndex()); } csv.AppendLine(); File.AppendAllText(statsFilePath, csv.ToString()); }
public override void Entry(IModHelper helper) { instance = this; helper.Events.GameLoop.SaveLoaded += OnLoad; Log("RetroActive Achievement Loader by Iceburg333 => Initialized"); }
public override void Entry(IModHelper helper) { instance = this; statsFilePath = helper.DirectoryPath + Path.DirectorySeparatorChar; helper.Events.GameLoop.Saved += AfterSaveEvent; helper.Events.Display.MenuChanged += OnShippingBinUpdate; helper.Events.World.ChestInventoryChanged += OnChestChanged; chestsToShip = new Dictionary <Chest, List <Item> >(); farmerItems = new Dictionary <Farmer, List <Item> >(); //also maybe could use: //GameEvents.Events.TimeEvents.DayOfMonthChanged Log("Shipment Tracker by Iceburg333 => Initialized"); }