Ejemplo n.º 1
0
        private void UpdateRecipesDisplayed()
        {
            lbRecipes.Items.Clear();

            if (null == Session["ProfSelected"])
            {
                Session["ProfSelected"] = dlProfession.SelectedValue;
            }

            var prof = (string)Session["ProfSelected"];

            int tierSelected = -1;

            if (dlTier.SelectedValue != "* ALL *")
            {
                tierSelected = (int)ProfessionTier.GetTier(dlTier.SelectedValue);
            }

            var recipes = (SortedDictionary <string, Ingredient>)Application["Recipes"];

            foreach (Ingredient rec in recipes.Values)
            {
                var comp = (CompositeIngredients)rec; // down-cast for tier
                if (
                    ((rec is CookIngredients) && ("Cook" == prof)) ||
                    ((rec is JewelerIngredients) && ("Jeweler" == prof)) ||
                    ((rec is MetalsmithIngredients) && ("Metalsmith" == prof)) ||
                    ((rec is ScholarCompIngredients) && ("Scholar" == prof)) ||
                    ((rec is TailorIngredients) && ("Tailor" == prof)) ||
                    ((rec is WeaponsmithIngredients) && ("Weaponsmith" == prof)) ||
                    ((rec is WoodworkerIngredients) && ("Woodworker" == prof))
                    )
                {
                    if (((tierSelected < 0) && ((int)comp.Tier < dlTier.Items.Count - 1)) ||
                        (tierSelected == (int)comp.Tier))
                    {
                        lbRecipes.Items.Add(comp.Name);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void addCraftingXp(Ingredient ing, ref DataSet1.dtCraftingXPDataTable dtCraftingXp)
        {
            if (!(ing is CompositeIngredients))
            {
                return;
            }

            if (ing is CookIngredients)
            {
                var compIng       = (CookIngredients)ing;
                var hasProfession = (bool)Session["Cook"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["CookTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Cook += xp;
                }
            }
            else if (ing is JewelerIngredients)
            {
                var compIng       = (JewelerIngredients)ing;
                var hasProfession = (bool)Session["Jeweler"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["JewelerTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Jeweler += xp;
                }
            }
            else if (ing is ForesterCompIngredients)
            {
                var compIng       = (ForesterCompIngredients)ing;
                var hasProfession = (bool)Session["Forester"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["ForesterTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Forester += xp;
                }
            }
            else if (ing is MetalsmithIngredients)
            {
                var compIng       = (MetalsmithIngredients)ing;
                var hasProfession = (bool)Session["Metalsmith"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["MetalsmithTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Metalsmith += xp;
                }
            }
            else if (ing is ProspectorCompIngredients)
            {
                var compIng       = (ProspectorCompIngredients)ing;
                var hasProfession = (bool)Session["Prospector"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["ProspectorTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Prospector += xp;
                }
            }
            else if (ing is ScholarCompIngredients)
            {
                var compIng       = (ScholarCompIngredients)ing;
                var hasProfession = (bool)Session["Scholar"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["ScholarTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Scholar += xp;
                }
            }
            else if (ing is TailorIngredients)
            {
                var compIng       = (TailorIngredients)ing;
                var hasProfession = (bool)Session["Tailor"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["TailorTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Tailor += xp;
                }
            }
            else if (ing is WeaponsmithIngredients)
            {
                var compIng       = (WeaponsmithIngredients)ing;
                var hasProfession = (bool)Session["Weaponsmith"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["WeaponsmithTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Weaponsmith += xp;
                }
            }
            else if (ing is WoodworkerIngredients)
            {
                var compIng       = (WoodworkerIngredients)ing;
                var hasProfession = (bool)Session["Woodworker"];
                var tierAvail     = ProfessionTier.GetTier((string)Session["WoodworkerTier"]);
                if (hasProfession && (tierAvail >= compIng.Tier)) // deconstructing so add xp
                {
                    var xp   = compIng.CraftingExperience * ing.QuantityRequested;
                    var tier = (int)compIng.Tier;
                    ((DataSet1.dtCraftingXPRow)dtCraftingXp.Rows[tier]).Woodworker += xp;
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateTiersDisplayed()
        {
            dlTier.Items.Clear();
            dlTier.Items.Add("* ALL *");

            string prof = "Cook";

            if (Session["ProfSelected"] != null)
            {
                prof = (string)Session["ProfSelected"];
            }

            ProfessionTierEnum tierAvail = ProfessionTierEnum.Supreme;

            switch (prof)
            {
            case "Cook":
                tierAvail = ProfessionTier.GetTier((string)Session["CookTier"]);
                break;

            case "Jeweler":
                tierAvail = ProfessionTier.GetTier((string)Session["JewelerTier"]);
                break;

            case "Metalsmith":
                tierAvail = ProfessionTier.GetTier((string)Session["MetalsmithTier"]);
                break;

            case "Scholar":
                tierAvail = ProfessionTier.GetTier((string)Session["ScholarTier"]);
                break;

            case "Tailor":
                tierAvail = ProfessionTier.GetTier((string)Session["TailorTier"]);
                break;

            case "Weaponsmith":
                tierAvail = ProfessionTier.GetTier((string)Session["WeaponsmithTier"]);
                break;

            case "Woodworker":
                tierAvail = ProfessionTier.GetTier((string)Session["WoodworkerTier"]);
                break;
            }

            if (tierAvail >= ProfessionTierEnum.Apprentice)
            {
                dlTier.Items.Add("Apprentice");
            }
            if (tierAvail >= ProfessionTierEnum.Journeyman)
            {
                dlTier.Items.Add("Journeyman");
            }
            if (tierAvail >= ProfessionTierEnum.Expert)
            {
                dlTier.Items.Add("Expert");
            }
            if (tierAvail >= ProfessionTierEnum.Artisan)
            {
                dlTier.Items.Add("Artisan");
            }
            if (tierAvail >= ProfessionTierEnum.Master)
            {
                dlTier.Items.Add("Master");
            }
            if (tierAvail >= ProfessionTierEnum.Supreme)
            {
                dlTier.Items.Add("Supreme");
            }
            if (tierAvail >= ProfessionTierEnum.Westfold)
            {
                dlTier.Items.Add("Westfold");
            }
            if (tierAvail >= ProfessionTierEnum.Eastemnet)
            {
                dlTier.Items.Add("Eastemnet");
            }
            if (tierAvail >= ProfessionTierEnum.Westemnet)
            {
                dlTier.Items.Add("Westemnet");
            }

            if (null == (Session["TierSelected"]))
            {
                dlTier.SelectedIndex = 1;
            }
            else
            {
                if (dlTier.Items.Contains(new ListItem((string)Session["TierSelected"])))
                {
                    dlTier.SelectedValue = (string)Session["TierSelected"];
                }
                else
                {
                    dlTier.SelectedIndex = 1;
                }
            }
            Session["TierSelected"] = dlTier.SelectedValue;
        }
Ejemplo n.º 4
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);
            }
        }