Exemplo n.º 1
0
        private static int FindAlchemyResult(EntityList ingredients, EntityList ready, ref bool refExact)
        {
            for (int i = 1; i < dbRecipes.Length; i++)
            {
                RecipeRec recipe = dbRecipes[i];

                int t_cnt  = AuxUtils.GetTokensCount(recipe.Ingredients, "+");
                int finded = 0;
                ready.Clear();

                for (int t = 1; t <= t_cnt; t++)
                {
                    string tok = AuxUtils.GetToken(recipe.Ingredients, "+", (sbyte)t);
                    char   f   = tok[0];
                    if (f != '_' && f != '!')
                    {
                        f = '?';
                    }
                    else
                    {
                        tok = tok.Substring(1, tok.Length - 1);
                    }

                    if (f == '_')
                    {
                        Item       item = (Item)ingredients.FindByCLSID(GlobalVars.iid_DeadBody);
                        NWCreature db   = (NWCreature)item.Contents.GetItem(0);
                        if (db.Entry.Sign.CompareTo(tok) == 0)
                        {
                            finded++;
                            ready.Add(item);
                        }
                    }
                    else
                    {
                        int  id   = GlobalVars.nwrDB.FindEntryBySign(tok).GUID;
                        Item item = (Item)ingredients.FindByCLSID(id);
                        if (item != null && (f == '?' || (f == '!' && item.State == ItemState.is_Blessed)))
                        {
                            finded++;
                            ready.Add(item);
                        }
                    }
                }

                if (finded >= t_cnt)
                {
                    refExact = (finded == t_cnt);
                    return(i);
                }
            }

            refExact = false;
            return(-1);
        }
Exemplo n.º 2
0
 static Craft()
 {
     dbRecipes     = new RecipeRec[17];
     dbRecipes[0]  = new RecipeRec("Potion_Mystery", "*");
     dbRecipes[1]  = new RecipeRec("Potion_Rejuvenation", "Potion_Curing+Potion_RestoreMagic");
     dbRecipes[2]  = new RecipeRec("Potion_Lycanthropy", "_Werewolf+Potion_Transformation");
     dbRecipes[3]  = new RecipeRec("Potion_Curing", "Potion_DrinkingWater+GnarledRoot");
     dbRecipes[4]  = new RecipeRec("Potion_Speed", "_Blur+Potion_DrinkingWater");
     dbRecipes[5]  = new RecipeRec("Potion_Blindness", "_IvyCreeper+Potion_DrinkingWater+RedMushroom");
     dbRecipes[6]  = new RecipeRec("Potion_Constitution", "Potion_DrinkingWater+BleachedRoot");
     dbRecipes[7]  = new RecipeRec("Potion_Hallucination", "Potion_DrinkingWater+SpeckledGrowth+Potion_Mead");
     dbRecipes[8]  = new RecipeRec("Potion_Endurance", "GreenMushroom+Potion_DrinkingWater");
     dbRecipes[9]  = new RecipeRec("Potion_SecondLife", "_LowerDwarf+!Potion_Curing+!Potion_HolyWater");
     dbRecipes[10] = new RecipeRec("Potion_Transformation", "_Morph+Potion_DrinkingWater");
     dbRecipes[11] = new RecipeRec("Potion_Depredation", "_Nymph+Potion_DrinkingWater");
     dbRecipes[12] = new RecipeRec("Potion_Translucence", "_Stalker+Potion_DrinkingWater");
     dbRecipes[13] = new RecipeRec("Potion_Venom", "_Glard+Potion_DrinkingWater");
     dbRecipes[14] = new RecipeRec("Potion_Paralysis", "_Homunculus+Potion_DrinkingWater");
     dbRecipes[15] = new RecipeRec("Potion_Experience", "_Wraith+Potion_DrinkingWater");
     dbRecipes[16] = new RecipeRec("Potion_DimensionSwitch", "_Breleor+Potion_DrinkingWater");
 }