static void OnSpoilerLogCreationAccepted(GameSave save) { var seed = save.GetSeed(); if (!seed.HasValue) { return; } using (var file = new StreamWriter(GetFileName(seed.Value))) { file.WriteLine($"Seed: {seed}"); file.WriteLine($"Timespinner version: v{TimeSpinnerGame.Constants.GameVersion}"); file.WriteLine($"TsRandomizer version: v{Assembly.GetExecutingAssembly().GetName().Version}"); var itemLocations = Randomizer.Randomize(seed.Value, save.GetFillingMethod()); var progressionItems = itemLocations.Where(l => l.ItemInfo.Unlocks != Requirement.None); var otherItems = itemLocations.Where(l => l.ItemInfo.Unlocks == Requirement.None); WriteProgressionChain(file, itemLocations); WriteItemListSection(file, progressionItems, "Progression Items:"); WriteItemListSection(file, otherItems, "Other Locations:"); } }
void ShowSpoilerGenerationDialog(GameSave save) { var seed = save.GetSeed(); if (!seed.HasValue) { return; } var messageBox = MessageBox.Create(ScreenManager, "Generate Spoiler log?", _ => OnSpoilerLogCreationAccepted(save)); ScreenManager.AddScreen(messageBox.Screen, GameScreen.ControllingPlayer); }
public static void PopulateOrbLookups(GameSave save, string setting, Dictionary <string, OrbDamageOdds> overrides) { OrbDamageLookup.Clear(); Dictionary <string, OrbDamageOdds> orbOdds = GetOrbOdds(setting, overrides); var random = new Random((int)save.GetSeed().Value.Id); foreach (KeyValuePair <string, OrbDamageOdds> odds in orbOdds) { EInventoryOrbType orbType = (EInventoryOrbType)Enum.Parse(typeof(EInventoryOrbType), odds.Key); RandomizeOrb(odds.Key, odds.Value, random); var orbInventory = save.Inventory.OrbInventory.Inventory; if (orbInventory.ContainsKey((int)orbType)) { SetOrbBaseDamage(orbInventory[(int)orbType]); } } }
public void BaseOnSave(GameSave gameSave) { var progressiveItemInfos = this .Where(l => l.ItemInfo is PogRessiveItemInfo) .Select(l => (PogRessiveItemInfo)l.ItemInfo); foreach (var progressiveItem in progressiveItemInfos) { progressiveItem.Reset(); } foreach (var itemLocation in this) { itemLocation.BsseOnGameSave(gameSave); } var seed = gameSave.GetSeed(); if (seed.HasValue && seed.Value.Options.StartWithTalaria) { this[ItemKey.TalariaSeedOption].SetPickedUp(); } }
void OnSpoilerLogCreationAccepted(GameSave save) { var fillingMethod = save.GetFillingMethod(); if (fillingMethod == FillingMethod.Archipelago) { var messageBox = MessageBox.Create(ScreenManager, "Not supported for Archipelago based seed"); ScreenManager.AddScreen(messageBox.Screen, GameScreen.ControllingPlayer); return; } var seed = save.GetSeed(); if (!seed.HasValue) { return; } using (var file = new StreamWriter(GetFileName(seed.Value))) { file.WriteLine($"Seed: {seed.Value}"); file.WriteLine($"Timespinner version: v{TimeSpinnerGame.Constants.GameVersion}"); file.WriteLine($"TsRandomizer version: v{Assembly.GetExecutingAssembly().GetName().Version}"); var itemLocations = Randomizer.Randomize(seed.Value, fillingMethod, save); var progressionItems = itemLocations.Where(l => l.ItemInfo.Unlocks != Requirement.None); var otherItems = itemLocations.Where(l => l.ItemInfo.Unlocks == Requirement.None); WriteProgressionChain(file, itemLocations); WriteItemListSection(file, progressionItems, "Progression Items:"); WriteItemListSection(file, otherItems, "Other Locations:"); } }