Esempio n. 1
0
        public static DataSet1.dtIngCraftedDataTable SortCraftedIngDataTable(DataSet1.dtIngCraftedDataTable dtIngredsIn)
        {
            var sDict = new SortedDictionary <string, DataSet1.dtIngCraftedRow>();

            foreach (DataSet1.dtIngCraftedRow row in dtIngredsIn.Rows)
            {
                sDict.Add(row.IngredientName, row);
            }

            var dtIngredsOut = new DataSet1.dtIngCraftedDataTable();

            foreach (DataSet1.dtIngCraftedRow row in sDict.Values)
            {
                DataSet1.dtIngCraftedRow newRow = dtIngredsOut.NewdtIngCraftedRow();
                newRow.Facility       = row.Facility;
                newRow.Profession     = row.Profession;
                newRow.Quantity       = row.Quantity;
                newRow.IngredientName = row.IngredientName;
                newRow.Tier           = row.Tier;
                dtIngredsOut.AdddtIngCraftedRow(newRow);
            }

            return(dtIngredsOut);
        }
Esempio n. 2
0
        private void AddComponentToOutput(CompositeIngredients compIng, ref long supplierTotal,
                                          ref DataSet1.dtIngCraftedDataTable dtIngCrafted,
                                          ref DataSet1.dtIngGatheredDataTable dtIngGathered,
                                          ref DataSet1.dtIngSupplierDataTable dtIngSupplier,
                                          ref DataSet1.dtCraftingXPDataTable dtCraftingXp)
        {
            bool bFound = false;

            foreach (DataSet1.dtIngCraftedRow row in dtIngCrafted.Rows)
            {
                if (row.IngredientName == compIng.Name)
                {
                    row.Quantity = Convert.ToString(Convert.ToInt32(row.Quantity) + Convert.ToInt32(compIng.QuantityRequested));
                    bFound       = true;
                    break;
                }
            }
            if (!bFound)
            {
                DataSet1.dtIngCraftedRow dtRow = dtIngCrafted.NewdtIngCraftedRow();
                dtRow.Quantity       = compIng.QuantityRequested.ToString();
                dtRow.Profession     = GetProfession(compIng);
                dtRow.IngredientName = compIng.Name;
                dtRow.Tier           = ProfessionTier.FormatTier(compIng.Tier);
                dtRow.Facility       = GetFacility(compIng);
                dtIngCrafted.AdddtIngCraftedRow(dtRow);
            }
            addCraftingXp(compIng, ref dtCraftingXp);

            if (compIng is CookIngredients)
            {
                var hasProfession = (bool)Session["Cook"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["CookTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is ForesterCompIngredients)
            {
                var hasProfession = (bool)Session["Forester"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["ForesterTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is JewelerIngredients)
            {
                var hasProfession = (bool)Session["Jeweler"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["JewelerTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is MetalsmithIngredients)
            {
                var hasProfession = (bool)Session["Metalsmith"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["MetalsmithTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is ProspectorCompIngredients)
            {
                var hasProfession = (bool)Session["Prospector"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["ProspectorTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is ScholarCompIngredients)
            {
                var hasProfession = (bool)Session["Scholar"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["ScholarTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is TailorIngredients)
            {
                var hasProfession = (bool)Session["Tailor"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["TailorTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is WeaponsmithIngredients)
            {
                var hasProfession = (bool)Session["Weaponsmith"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["WeaponsmithTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
            else if (compIng is WoodworkerIngredients)
            {
                var hasProfession = (bool)Session["Woodworker"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["WoodworkerTier"]);
                Deconstruct(hasProfession, tierAvail, ref supplierTotal,
                            compIng, ref dtIngCrafted, ref dtIngGathered, ref dtIngSupplier, ref dtCraftingXp);
            }
        }