示例#1
0
        int[,] compopsites; //advanced materials

        public Calculator()
        {
            Console.WriteLine("..Loading the database...");
            dataBase = new db.Db();
            Console.WriteLine("..Done loading the database");
            Console.WriteLine("..Authenticating with SSO...");
            new ESI.Login(ESI.CharacterEnum.BuildCorp);
            new ESI.Login(ESI.CharacterEnum.EmpireDonkey);
            Console.WriteLine("..Done authenticating");
            Console.WriteLine("..Importing API's...");
            apiImports = new ApiImport.MainImport();
            Console.WriteLine("..Done importing API's");
            Console.WriteLine("..Generating the market Class...");
            market = new Market.Market(dataBase);
            Console.WriteLine("..Done generating the market class");
            Console.WriteLine("..Calculates t2 production...");
            T2Builder t2mods = new T2Builder(dataBase, market);

            Console.WriteLine("..Done calculating t2 production");
            Console.WriteLine("..Generates output files...");
            Output.Output output = new Output.Output(t2mods, dataBase, market, apiImports);
            Console.WriteLine("..Done generating output files");
        }
示例#2
0
        public MarketInfo(db.Db dataBase, calculator.T2Builder t2mods, ApiImport.MainImport import, Market.Market market)
        {
            using (StreamWriter sw = new StreamWriter("marketInfo.txt"))
            {
                var office = import.ESIbuildCorpAssets.GetContainer(1022964286749);
                int i      = 0;

                sw.WriteLine("Name" + "\t" + "Buildcost" + "\t" + "Haulingcost" + "\t" + "Market sell" + "\t" + "Amount on market" + "\t" + "Stock in xanadu" + "\t" + "Stock in chanuur"
                             + "\t" + "Order price" + "\t" + "Avg daily volume" + "\t" + "Item category" + "\t" + "Max output");
                while (i < t2mods.OutputName.Length)
                {
                    decimal itemCost       = t2mods.OutputTotalCost[i] / t2mods.Output[i, 1];
                    decimal haulingCost    = dataBase.types.GetRepackagedVolume(t2mods.Output[i, 0]) * 800;
                    decimal marketSell     = market.FindPrice(dataBase.settings.MarketRegion, "sell", t2mods.Output[i, 0]);
                    decimal sellOrderPrize = import.ESIcorpMarketOrders.SellOrderPrice(t2mods.Output[i, 0]);
                    sw.WriteLine(
                        t2mods.OutputName[i]                                                                                                //name
                        + "\t" + itemCost.ToString(StaticInfo.ci)                                                                           //cost per item
                        + "\t" + haulingCost.ToString(StaticInfo.ci)                                                                        // hauling cost per item (800 is ITL's price per m3 from delve to jita, hardcoding it because im lazy
                        + "\t" + marketSell.ToString(StaticInfo.ci)                                                                         // gets the sale value of the item
                        + "\t" + import.ESIcorpMarketOrders.ItemsOnMarket(t2mods.Output[i, 0])                                              //amount we have on the market
                        + "\t" + import.ESIempireDonkey.FindItem(t2mods.Output[i, 0])                                                       // amount on Reluah
                        + "\t" + office.FindItem(t2mods.Output[i, 0])                                                                       // ammount on chanuur
                        + "\t" + sellOrderPrize.ToString(StaticInfo.ci)                                                                     // value of our sell order
                        + "\t" + market.FindAverageVolume(dataBase.settings.MarketRegion, t2mods.Output[i, 0], 30)                          // average volume sold per day(last 30 days)
                        + "\t" + dataBase.categoryIDs.GetName(dataBase.groupIDs.CategoryID(dataBase.types.GroupID(t2mods.Output[i, 0])), 0) // items category
                        + "\t" + t2mods.Output[i, 1]                                                                                        //amount of items produced per cycle
                        );
                    i++;
                }
                sw.WriteLine("market orders cached until" + "\t" + import.ESIcorpMarketOrders.CachedUntil);
                sw.WriteLine("build corp assets cached until" + "\t" + import.ESIbuildCorpAssets.CachedUntil);
                sw.WriteLine("empire donkey corp assets cached until" + "\t" + import.ESIempireDonkey.CachedUntil);
                sw.Close();
            }
            System.Diagnostics.Process.Start(@"marketInfo.txt");
        }
        public RawMaterialTableBuilder(db.Db dataBase, calculator.T2Builder t2builder, Market.Market market, StreamWriter sw, string tableName, ApiImport.MainImport import)
        {
            var office = import.ESIbuildCorpAssets.GetContainer(1022964286749);

            long[,] materials = new long[1, 1];
            if (tableName == "Minerals")
            {
                materials = t2builder.GetGroup(4);
            }
            else if (tableName == "Planetary Interaction")
            {
                materials = t2builder.GetGroup(2);
            }
            else if (tableName == "Advanced Materials")
            {
                materials = t2builder.GetGroup(6);
            }
            string[] names = new string[materials.Length / 2];
            int      i     = 0;

            while (i < names.Length)
            {
                names[i] = dataBase.types.TypeName(materials[i, 0]);
                i++;
            }

            sw.WriteLine("<table>");
            sw.WriteLine("<caption><b>" + tableName + "</b></caption>");
            sw.WriteLine("<tr><td>Name</td><td>Needed</td><td>Have</td><td>Lacking</td><td>Value</td></tr>");
            i = 0;
            decimal totalValue = 0;

            while (i < names.Length)
            {
                long    need = materials[i, 1];
                long    have = office.FindItem(Convert.ToInt32(materials[i, 0]));
                long    lacking;
                decimal value = 0;
                if (have - need >= 0)
                {
                    lacking = 0;
                }
                else
                {
                    lacking = need - have;
                    value   = market.FindPrice("the forge", "buy", materials[i, 0]) * lacking; totalValue += value;
                }
                sw.WriteLine("<tr><td>" + names[i] + "</td><td>" +
                             string.Format("{0:n0}", need) + "</td><td>" +
                             string.Format("{0:n0}", have) + "</td><td>" +
                             string.Format("{0:n0}", lacking) + "</td><td>" +
                             string.Format("{0:n0}", value) + "</td></tr>");
                i++;
            }
            sw.WriteLine("<tr><td><b>Sum</b></td><td></td><td><b>" +
                         null + "</b></td><td><b>" +
                         null + "</b></td><td><b>" +
                         string.Format("{0:n0}", totalValue) + "</b></td></tr>");
            sw.WriteLine("</table>");
        }
示例#4
0
        public Output(calculator.T2Builder t2mods, db.Db dataBase, Market.Market market, ApiImport.MainImport import)
        {
            StreamReader sr;

            using (StreamWriter sw = new StreamWriter("moduleNumbers.html"))
            {
                using (sr = new StreamReader("files\\htmloutputone.txt"))
                {
                    sw.WriteLine(sr.ReadToEnd());
                    OutputTableBuilder       otb = new OutputTableBuilder(dataBase, t2mods, sw, "T2Modules(and ships)");
                    IntermediaryTableBuilder itb = new IntermediaryTableBuilder(dataBase, t2mods, sw, "T2Components", import, market);
                    itb = new IntermediaryTableBuilder(dataBase, t2mods, sw, "T1modules", import, market);
                    itb = new IntermediaryTableBuilder(dataBase, t2mods, sw, "T1ships", import, market);
                    itb = new IntermediaryTableBuilder(dataBase, t2mods, sw, "Tools", import, market);

                    RawMaterialTableBuilder rmtb = new RawMaterialTableBuilder(dataBase, t2mods, market, sw, "Minerals", import);
                    rmtb = new RawMaterialTableBuilder(dataBase, t2mods, market, sw, "Planetary Interaction", import);
                    rmtb = new RawMaterialTableBuilder(dataBase, t2mods, market, sw, "Advanced Materials", import);
                }

                using (sr = new StreamReader("files\\htmloutputtwo.txt"))
                    sw.WriteLine(sr.ReadToEnd());
                sw.Close();
            }

            System.Diagnostics.Process.Start(@"moduleNumbers.html");

            new MarketInfo(dataBase, t2mods, import, market);
        }
示例#5
0
        public IntermediaryTableBuilder(db.Db dataBase, calculator.T2Builder t2builder, StreamWriter sw, string tableName, ApiImport.MainImport import, Market.Market market)
        {
            var office = import.ESIbuildCorpAssets.GetContainer(1022964286749);

            long[,] materials = new long[1, 1];
            if (tableName == "T2Components")
            {
                materials = t2builder.GetGroup(5);
            }
            else if (tableName == "T1modules")
            {
                materials = t2builder.GetGroup(0);
            }
            else if (tableName == "T1ships")
            {
                materials = t2builder.GetGroup(1);
            }
            else if (tableName == "Tools")
            {
                materials = t2builder.GetGroup(3);
            }
            string[] names = new string[materials.Length / 2];
            int      i     = 0;

            while (i < names.Length)
            {
                names[i] = dataBase.types.TypeName(materials[i, 0]);
                i++;
            }

            sw.WriteLine("<table>");
            sw.WriteLine("<caption><b>" + tableName + "</b></caption>");
            sw.WriteLine("<tr><td>Name</td><td>Needed</td><td>Have</td><td>Building</td><td>Lacking</td><td>Value</td></tr>");
            i = 0;
            decimal totalValue = 0;

            while (i < names.Length)
            {
                long need     = materials[i, 1];
                long have     = office.FindItem(Convert.ToInt32(materials[i, 0]));
                long building = import.ESIjobs.GetJobs(Convert.ToInt32(materials[i, 0]), dataBase);
                long lacking;
                if ((have + building) - need >= 0)
                {
                    lacking = 0;
                }
                else
                {
                    lacking = need - building - have;
                }
                decimal value = market.FindPrice("the forge", "buy", materials[i, 0]) * lacking; totalValue += value;
                sw.WriteLine("<tr><td>" + names[i] + "</td><td>" +
                             string.Format("{0:n0}", need) + "</td><td>" +
                             string.Format("{0:n0}", have) + "</td><td>" +
                             string.Format("{0:n0}", building) + "</td><td>" +
                             string.Format("{0:n0}", lacking) + "</td><td>" +
                             string.Format("{0:n0}", value) + "</td></tr>");
                i++;
            }
            sw.WriteLine("<tr><td><b>Sum</b></td><td>" + null + "</td><td>" + null + "</td><td>" + null + "</td><td>" + null + "</td><td><b>" + string.Format("{0:n0}", totalValue) + "</b></td></tr>");
            sw.WriteLine("</table>");
        }