Beispiel #1
0
        public Dicts InitializeMobSheet(string mobName, MobAsociatedDrops data)
        {
            Dicts d = new Dicts(true);

            interaction.InsertValue(new ExcelCellAddress(1, 1), "Spreadsheet for enemy: " + interaction.currentSheet.Name);
            interaction.InsertValue(new ExcelCellAddress(1, 4), "Num killed:");
            interaction.InsertValue(new ExcelCellAddress(1, 5), 0);

            Dictionary <string, string[]> itemEntries = Program.gameRecognizer.enemyHandling.mobDrops.GetDropsForMob(mobName);

            ExcelCellAddress startAddr = new ExcelCellAddress("A2");

            foreach (string key in itemEntries.Keys)
            {
                interaction.currentSheet.Cells[startAddr.Address].Value = key;

                for (int i = 0; i < itemEntries[key].Length; i++)
                {
                    int _offset = i + 1;
                    ExcelCellAddress itemName    = new ExcelCellAddress(startAddr.Row + _offset, startAddr.Column);
                    ExcelCellAddress yangVal     = new ExcelCellAddress(startAddr.Row + _offset, startAddr.Column + 1);
                    ExcelCellAddress totalDroped = new ExcelCellAddress(startAddr.Row + _offset, startAddr.Column + 2);
                    interaction.InsertValue(itemName, itemEntries[key][i]);
                    d.addresses.Add(itemEntries[key][i], totalDroped);
                    interaction.InsertValue(yangVal, DefinitionParser.instance.currentGrammarFile.GetYangValue(itemEntries[key][i]));
                    interaction.InsertValue(totalDroped, 0);
                }
                startAddr = new ExcelCellAddress(2, startAddr.Column + 4);
            }
            interaction.Save();
            return(d);
        }
Beispiel #2
0
        /// <summary>
        /// Adjusts collumn width of current sheet
        /// </summary>
        public void AutoAdjustColumns(Dictionary <string, SpreadsheetInteraction.Group> .ValueCollection values)
        {
            double currMaxWidth = 0;

            foreach (SpreadsheetInteraction.Group g in values)
            {
                for (int i = 0; i < g.totalEntries; i++)
                {
                    main.currentSheet.Cells[g.elementNameFirstIndex.Row + i, g.elementNameFirstIndex.Column].AutoFitColumns();
                    if (main.currentSheet.Column(g.elementNameFirstIndex.Column).Width >= currMaxWidth)
                    {
                        currMaxWidth = main.currentSheet.Column(g.elementNameFirstIndex.Column).Width;
                    }
                }
                main.currentSheet.Column(g.elementNameFirstIndex.Column).Width = currMaxWidth;
                currMaxWidth = 0;

                for (int i = 0; i < g.totalEntries; i++)
                {
                    int s = main.currentSheet.GetValue <int>(g.yangValueFirstIndex.Row + i, g.yangValueFirstIndex.Column);
                    main.currentSheet.Column(g.yangValueFirstIndex.Column).Width = GetCellWidth(s, false);
                    if (main.currentSheet.Column(g.yangValueFirstIndex.Column).Width > currMaxWidth)
                    {
                        currMaxWidth = main.currentSheet.Column(g.yangValueFirstIndex.Column).Width;
                    }
                }
                main.currentSheet.Column(g.yangValueFirstIndex.Column).Width = currMaxWidth;
                currMaxWidth = 0;
            }
            main.Save();
        }