Exemplo n.º 1
0
    // Loops around an item to reach in the triggered effects, to see if it can satisfy food and water requirements.
    public ItemValue IsConsumable(ItemValue item, String strSearchType)
    {
        DisplayLog(" IsConsumable() " + item.ItemClass.Name);
        DisplayLog(" Checking for : " + strSearchType);
        foreach (var Action in item.ItemClass.Actions)
        {
            if (Action is ItemActionEat)
            {
                DisplayLog(" Action Is Eat");
                foreach (var EffectGroup in item.ItemClass.Effects.EffectGroups)
                {
                    foreach (var TriggeredEffects in EffectGroup.TriggeredEffects)
                    {
                        MinEventActionModifyCVar effect = TriggeredEffects as MinEventActionModifyCVar;
                        if (effect == null)
                        {
                            continue;
                        }

                        DisplayLog(" Checking Effects");
                        if (strSearchType == "Food")
                        {
                            if ((effect.cvarName == "$foodAmountAdd") || (effect.cvarName == "foodHealthAmount"))
                            {
                                return(item);
                            }
                        }
                        else if (strSearchType == "Water")
                        {
                            if ((effect.cvarName == "$waterAmountAdd") || (effect.cvarName == "waterHealthAmount"))
                            {
                                return(item);
                            }
                        }
                    }
                }
            }
        }

        return(null);
    }
Exemplo n.º 2
0
    public static bool CheckItemForConsumable(MinEffectGroup group, List <String> cvars)
    {
        bool result = false;

        foreach (var TriggeredEffects in group.TriggeredEffects)
        {
            MinEventActionModifyCVar effect = TriggeredEffects as MinEventActionModifyCVar;
            if (effect == null)
            {
                continue;
            }

            DisplayLog(" Checking Effects: " + effect.cvarName + " " + effect.GetValueForDisplay());
            if (cvars.Contains(effect.cvarName))
            {
                return(true);
            }
        }

        return(result);
    }