static private WorldEvent GenerateEvent(int id, string[] target, Random rnd) { WorldEvent newWorldEvent; newWorldEvent = new WorldEvent(eventNameList[id], eventDesList[id], id, eventCounter, target, effectIDList[id], effectValList[id], durationList[id]); eventCounter++; int mod = rnd.Next(0, durationModList[id] + 1); if (rnd.Next(0, 2) == 1) { newWorldEvent.DaysLeft += mod; } else { newWorldEvent.DaysLeft -= mod; } GlossaryManager.CheckWorldEvents(newWorldEvent.EventID); return(newWorldEvent); }
static public bool GenerateSave(Inventory inventory, string location, string gameState) { string path = Path.Combine("./Saves/", "Save-" + DateTime.Now.ToString() + ".ptmsave"); StreamWriter streamWriter = new StreamWriter(ToSafeFileName(path), false); streamWriter.WriteLine(ver); SaveAchievements(streamWriter); streamWriter.WriteLine(gameState); streamWriter.WriteLine(Calendar.TotalDays); streamWriter.WriteLine(location); foreach (bool tempVisit in Player.VisitedCities) { if (tempVisit) { streamWriter.WriteLine("true"); } else { streamWriter.WriteLine("false"); } } int[] temp = Player.SkillLevels; for (int i = 0; i < 3; i++) { streamWriter.WriteLine(temp[i].ToString()); } streamWriter.WriteLine(CharCreationMenu.ConfirmedAvatar); SaveInventory(streamWriter, inventory); SaveIfTravelling(streamWriter); streamWriter.Close(); GlossaryManager.SaveGlossaries(); return(true); }