Beispiel #1
0
        protected decimal FindCosts(long[,] materials)
        {
            int i = 0; decimal cost = 0;

            while (i < materials.Length / 2)
            {
                decimal temp = market.FindPrice(dataBase.settings.MarketRegion, "buy", materials[i, 0]) * materials[i, 1];
                cost += market.FindPrice(dataBase.settings.MarketRegion, "buy", materials[i, 0]) * materials[i, 1];
                i++;
            }
            return(cost);
        }
        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>");
        }
Beispiel #3
0
        public T2Builder(db.Db dataBase_, Market.Market market)
            : base(market, dataBase_)
        {
            this.market         = market;
            t1Modules           = new long[256, 2];    // categoryid=7
            t1ships             = new long[256, 2];    // categoryid=6
            planetaryComodities = new long[256, 2];    // categoryid=43
            tools    = new long[256, 2];               // groupid=332
            minerals = new long[256, 2];               // groupid=18
            constructionComponents = new long[256, 2]; // groupid=334
            compopsites            = new long[256, 2]; // groupip=429

            dataBase      = dataBase_;
            moduleMats    = new int[dataBase.t2bpoOwned.Index()][, ];
            moduleAmounts = new int[dataBase.t2bpoOwned.Index()];

            output           = new int[dataBase.t2bpoOwned.Index(), 2];
            outputName       = new string[dataBase.t2bpoOwned.Index()];
            outputTotalValue = new decimal[dataBase.t2bpoOwned.Index()];
            outputTotalCost  = new decimal[dataBase.t2bpoOwned.Index()];

            int i = 0;

            while (i < dataBase.t2bpoOwned.Index()) // adds amounts
            {
                int bpoid = dataBase.t2bpoOwned.Bpo(i);
                moduleAmounts[i] = GetBuildAmount(bpoid);

                moduleMats[i]    = dataBase.bpo.ManufacturingMats(bpoid);
                materialModifier = MaterialModifier();

                int[,] bpoOutput    = dataBase.bpo.ManufacturingOutput(bpoid);
                output[i, 0]        = bpoOutput[0, 0]; output[i, 1] = bpoOutput[0, 1] * moduleAmounts[i];
                outputName[i]       = dataBase.types.TypeName(output[i, 0]);
                outputTotalValue[i] = output[i, 1] * market.FindPrice(dataBase.settings.MarketRegion, "sell", output[i, 0]);
                int j = 0;
                while (j < (moduleMats[i].Length / 2))
                {
                    if (moduleMats[i][j, 1] == 1)
                    {
                        moduleMats[i][j, 1] = Convert.ToInt32(Math.Ceiling(moduleMats[i][j, 1] * moduleAmounts[i] * 1.0));
                    }
                    else
                    {
                        moduleMats[i][j, 1] = Convert.ToInt32(Math.Ceiling(moduleMats[i][j, 1] * moduleAmounts[i] * materialModifier));
                    }
                    j++;
                }
                //test variable
                decimal installcost = FindInstallCost(bpoid) * moduleAmounts[i];
                outputTotalCost[i] = SortMaterials(moduleMats[i]) + installcost;
                i++;
            }
            TotalModuleMaterials();
        }
Beispiel #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");
        }
Beispiel #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>");
        }