Exemple #1
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);
        }
        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>");
        }
        public OutputTableBuilder(db.Db dataBase, calculator.T2Builder t2builder, StreamWriter sw, string tableName)
        {
            string[] name = t2builder.OutputName;
            int[,] output = t2builder.Output;
            decimal[] totalCost  = t2builder.OutputTotalCost;
            decimal[] totalValue = t2builder.OutputTotalValue;

            sw.WriteLine("<table>");
            sw.WriteLine("<caption><b>" + tableName + "</b></caption>");
            sw.WriteLine("<tr><td>Name</td><td>Amount</td><td>Value</td><td>Cost</td><td>Profit</td><td>Profit/m^3 ratio</td></tr>");
            int i = 0;

            while (i < name.Length)
            {
                decimal profit      = totalValue[i] - totalCost[i];
                decimal profitRatio = profit / (dataBase.types.GetRepackagedVolume(output[i, 0]) * output[i, 1]);
                sw.WriteLine("<tr><td>" +
                             string.Format("{0:n0}", name[i]) + "</td><td>" +
                             string.Format("{0:n0}", output[i, 1]) + "</td><td>" +
                             string.Format("{0:n0}", totalValue[i]) + "</td><td>" +
                             string.Format("{0:n0}", totalCost[i]) + "</td><td>" +
                             string.Format("{0:n0}", profit) + "</td><td>" +
                             string.Format("{0:n0}", profitRatio) + "</td></tr>");
                i++;
            }
            decimal valueSum = totalValue.Sum();
            decimal costSum  = totalCost.Sum();

            i = 0;
            decimal profitSum = 0;

            while (i < name.Length)
            {
                if ((totalValue[i] - totalCost[i]) > 0)
                {
                    profitSum += totalValue[i] - totalCost[i];
                }
                i++;
            }
            sw.WriteLine("<tr><td><b>Sum</b></td><td></td><td><b>" + string.Format("{0:n0}", valueSum) + "</b></td><td><b>" + string.Format("{0:n0}", costSum) + "</b></td><td><b>" + string.Format("{0:n0}", profitSum) + "</b></td></b><td></td></tr>");
            sw.WriteLine("</table>");
        }
Exemple #4
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");
        }
Exemple #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>");
        }