Esempio n. 1
0
        public string[] GetRecipeNames(String profession, ProfessionTierEnum tier)
        {
#if DECRYPT
            var decProfession = EncryptedString.DecryptString(profession, Seed);
#else
            var decProfession = profession;
#endif
            var recipes = (SortedDictionary <string, Ingredient>)Application["Recipes"];
            var lstRet  = new List <String>();

            foreach (Ingredient rec in recipes.Values)
            {
                var comp = (CompositeIngredients)rec; // down-cast for tier
                if (
                    ((rec is CookIngredients) && ("Cook" == decProfession)) ||
                    ((rec is JewelerIngredients) && ("Jeweler" == decProfession)) ||
                    ((rec is MetalsmithIngredients) && ("Metalsmith" == decProfession)) ||
                    ((rec is ScholarCompIngredients) && ("Scholar" == decProfession)) ||
                    ((rec is TailorIngredients) && ("Tailor" == decProfession)) ||
                    ((rec is WeaponsmithIngredients) && ("Weaponsmith" == decProfession)) ||
                    ((rec is WoodworkerIngredients) && ("Woodworker" == decProfession))
                    )
                {
                    if ((int)tier == (int)comp.Tier)
#if DECRYPT
                    { lstRet.Add(EncryptedString.EncryptString(comp.Name, Seed)); }
#else
                    { lstRet.Add(comp.Name); }
#endif
                }
            }
            //System.Threading.Thread.Sleep(5000);
            return(lstRet.ToArray());
        }
Esempio n. 2
0
        private WebIngredient GetWebIngredient(Ingredient ing, int quantity)
        {
            var wi = new WebIngredient
            {
#if DECRYPT
                IngredientName = EncryptedString.EncryptString(ing.Name, Seed),
#else
                IngredientName = ing.Name,
#endif
                //IngredientName = ing.Name,
                Quantity = quantity,
#if DECRYPT
                IngredientType = EncryptedString.EncryptString(ing.FormatIngredientType(), Seed)
#else
                IngredientType = ing.FormatIngredientType()
#endif
                                 //IngredientType = ing.FormatIngredientType()
            };

            if (ing is CompositeIngredients)
            {
                var ci = (CompositeIngredients)ing;
                wi.IsCrafted = true;
#if DECRYPT
                wi.Tier = EncryptedString.EncryptString(ci.Tier.ToString(), Seed);
#else
                wi.Tier = ci.Tier.ToString();
#endif
                wi.Xp = ci.CraftingExperience;
            }
            else // SimpleIngredient
            {
                var simpIng = (SimpleIngredients)ing;
                if (simpIng is SupplierIngredients)
                {
                    var supIng = (SupplierIngredients)ing;
                    wi.SupplierCost = supIng.EstimatedCost * quantity;
                }
            }
            return(wi);
        }
    }