public void Refresh() { spreadsheets.Clear(); foreach (var f in Directory.EnumerateFiles(this.directory).Where(x => x.EndsWith(".tsv"))) { var sheet = new CardDataSpreadsheet(f); spreadsheets[sheet.Name] = sheet; } }
protected override void ExecuteInternal(ParameterSet parameters) { var sheetName = parameters.Get(Sheet); var debug = parameters.Get(Debug); CardDataSpreadsheet sheet = this.Context.SpreadsheetManager.Load(sheetName); SheetPrinter printer = new SheetPrinter(this.Context, new PrintOptions(debug, parameters.Get(NoCount), parameters.Get(NoPic))); printer.CreatePDF(sheet); Console.WriteLine("Done!"); Console.WriteLine(); }
protected override void ExecuteInternal(ParameterSet parameters) { var sheetName = parameters.Get(Sheet); var balanceData = BalanceLibrary.GetBalanceData(sheetName); CardDataSpreadsheet sheet = this.Context.SpreadsheetManager.Load(sheetName); var evaluator = new BalanceStringEvaluator(balanceData); List <BalancedCard> balanced = new List <BalancedCard>(); List <Tuple <double, string> > spells = new List <Tuple <double, string> >(); List <Tuple <double, string> > crops = new List <Tuple <double, string> >(); foreach (var card in sheet.Cards) { if (card.Id.Contains("blank")) { continue; } if (card.Type == "spell") { var spellCard = (SpellCardData)card; double budget = balanceData.Data[$"spellbudget{spellCard.PlantValue}"]; double effectest = evaluator.Evaluate(spellCard.EffectPowerEstimate); double vp = spellCard.Offerings; double opness = budget - effectest - vp; Tuple <double, string> output = new Tuple <double, string>( opness, $"{spellCard.Title}: budget={FormatDouble(budget)} est={FormatDouble(effectest)} vp={vp} sum={FormatDouble(effectest + vp)} delta={FormatDouble(opness)}"); spells.Add(output); } else if (card.Type == "crop") { var cropCard = (CropCardData)card; double budget = balanceData.Data[$"cropbudget{cropCard.PlantCost}_{cropCard.HarvestCost}"]; double effectsingleturnest = evaluator.Evaluate(cropCard.EffectPowerEstimate); double effectest = balanceData.CostCropEffect(cropCard.PlantCost, cropCard.HarvestCost, cropCard.EffectCost, effectsingleturnest); double harvestest = evaluator.Evaluate(cropCard.HarvestPowerEstimate); double vp = cropCard.Offerings; double totalpower = effectest + harvestest + vp; double opness = budget - totalpower; Tuple <double, string> output = new Tuple <double, string>( opness, $"{cropCard.Title}: budget={FormatDouble(budget)} harvestest={FormatDouble(harvestest)} effectest={FormatDouble(effectest)} vp={vp} sum={FormatDouble(totalpower)} delta={FormatDouble(opness)}"); crops.Add(output); } } Console.WriteLine("Spells"); foreach (var s in spells.OrderBy(x => x.Item1).Select(x => x.Item2)) { Console.WriteLine(s); } Console.WriteLine(); Console.WriteLine("Crops"); foreach (var s in crops.OrderBy(x => x.Item1).Select(x => x.Item2)) { Console.WriteLine(s); } }
protected override void ExecuteInternal(ParameterSet parameters) { var sheetName = parameters.Get(Sheet); var debug = parameters.Get(Debug); CardDataSpreadsheet sheet = this.Context.SpreadsheetManager.Load(sheetName); var spellCards = sheet.Cards.Where(x => x is SpellCardData).Select(x => x as SpellCardData); var cropCards = sheet.Cards.Where(x => x is CropCardData).Select(x => x as CropCardData); int[] cropSums = new int[8]; int[] spellSums = new int[8]; for (int i = 0; i < 8; i++) { cropSums[i] = cropCards.Where(x => x.Color != "white").Where(x => x.PlantCost == i).Sum(x => x.Count); spellSums[i] = spellCards.Where(x => x.PlantValue == i).Sum(x => x.Count); } Console.WriteLine(""); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine("Crops"); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine(""); for (int i = 0; i < 8; i++) { string bar = new string('=', cropSums[i]); Console.WriteLine(i.ToString() + ": " + bar + " " + cropSums[i].ToString()); } int[,] cropMatrix = new int[8, 8]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cropMatrix[i, j] = cropCards.Where(x => x.Color != "white").Where(x => x.PlantCost == i && x.HarvestCost == j).Sum(x => x.Count); } } Console.WriteLine(); Console.WriteLine("Plant \\ Dew"); Console.WriteLine(" 1 2 3 4 5 6 7"); for (int i = 1; i < 8; i++) { Console.Write(i + ": "); for (int j = 1; j < 8; j++) { Console.Write($"{cropMatrix[i, j].ToString().PadLeft(3)} "); } Console.WriteLine(); } Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine("Spells"); Console.WriteLine("----------------------------------------------------------------"); Console.WriteLine(""); for (int i = 0; i < 8; i++) { string bar = new string('=', spellSums[i]); Console.WriteLine(i.ToString() + ": " + bar + " " + spellSums[i].ToString()); } }