private static void Postfix(MedicinalPill __instance, ref List <Descriptor> __result)
 {
     if (__instance.info.id == "Stimulant")
     {
         __result.RemoveAt(0);
     }
 }
Esempio n. 2
0
    public static GameObject ExtendEntityToMedicine(GameObject template, MedicineInfo medicineInfo)
    {
        template.AddOrGet <EntitySplitter>();
        KPrefabID component = template.GetComponent <KPrefabID>();

        component.AddTag(GameTags.Medicine, false);
        MedicinalPill medicinalPill = template.AddOrGet <MedicinalPill>();

        medicinalPill.info = medicineInfo;
        return(template);
    }
Esempio n. 3
0
            public static void Postfix(MedicinalPill __instance, ref GameObject consumer, ref bool __result)
            {
                Effects component = consumer.GetComponent <Effects>();

                if ((Object)component == (Object)null || component.HasEffect(__instance.info.effect))
                {
                    __result = false;
                    return;
                }

                if (__instance.info.medicineType == MedicineInfo.MedicineType.Booster)
                {
                    AmountInstance amountInstance = Db.Get().Amounts.ImmuneLevel.Lookup(consumer);
                    if (amountInstance != null)
                    {
                        __result = (double)amountInstance.value < (double)amountInstance.GetMax() * 0.8f;
                        return;
                    }
                    __result = false;
                }
            }
    protected override void OnActivate()
    {
        title = UI.CONSUMABLESSCREEN.TITLE;
        base.OnActivate();
        AddPortraitColumn("Portrait", base.on_load_portrait, null, true);
        AddButtonLabelColumn("Names", base.on_load_name_label, base.get_value_name_label, delegate(GameObject widget_go)
        {
            GetWidgetRow(widget_go).SelectMinion();
        }, delegate(GameObject widget_go)
        {
            GetWidgetRow(widget_go).SelectAndFocusMinion();
        }, base.compare_rows_alphabetical, on_tooltip_name, base.on_tooltip_sort_alphabetically, false);
        AddLabelColumn("QOLExpectations", on_load_qualityoflife_expectations, get_value_qualityoflife_label, compare_rows_qualityoflife_expectations, on_tooltip_qualityoflife_expectations, on_tooltip_sort_qualityoflife_expectations, 96, true);
        List <IConsumableUIItem> list = new List <IConsumableUIItem>();

        for (int i = 0; i < FOOD.FOOD_TYPES_LIST.Count; i++)
        {
            list.Add(FOOD.FOOD_TYPES_LIST[i]);
        }
        List <GameObject> prefabsWithTag = Assets.GetPrefabsWithTag(GameTags.Medicine);

        for (int j = 0; j < prefabsWithTag.Count; j++)
        {
            MedicinalPill component = prefabsWithTag[j].GetComponent <MedicinalPill>();
            if ((bool)component)
            {
                list.Add(component);
            }
            else
            {
                DebugUtil.DevLogErrorFormat("Prefab tagged Medicine does not have MedicinalPill component: {0}", prefabsWithTag[j]);
            }
        }
        list.Sort(delegate(IConsumableUIItem a, IConsumableUIItem b)
        {
            int num2 = a.MajorOrder.CompareTo(b.MajorOrder);
            if (num2 == 0)
            {
                num2 = a.MinorOrder.CompareTo(b.MinorOrder);
            }
            return(num2);
        });
        ConsumerManager.instance.OnDiscover += OnConsumableDiscovered;
        List <ConsumableInfoTableColumn> list2 = new List <ConsumableInfoTableColumn>();
        List <DividerColumn>             list3 = new List <DividerColumn>();
        List <ConsumableInfoTableColumn> list4 = new List <ConsumableInfoTableColumn>();

        StartScrollableContent("consumableScroller");
        int num = 0;

        for (int k = 0; k < list.Count; k++)
        {
            if (list[k].Display)
            {
                if (list[k].MajorOrder != num && k != 0)
                {
                    string id = "QualityDivider_" + list[k].MajorOrder;
                    ConsumableInfoTableColumn[] quality_group_columns = list4.ToArray();
                    DividerColumn dividerColumn = new DividerColumn(delegate
                    {
                        if (quality_group_columns == null || quality_group_columns.Length == 0)
                        {
                            return(true);
                        }
                        ConsumableInfoTableColumn[] array = quality_group_columns;
                        foreach (ConsumableInfoTableColumn consumableInfoTableColumn in array)
                        {
                            if (consumableInfoTableColumn.isRevealed)
                            {
                                return(true);
                            }
                        }
                        return(false);
                    }, "consumableScroller");
                    list3.Add(dividerColumn);
                    RegisterColumn(id, dividerColumn);
                    list4.Clear();
                }
                ConsumableInfoTableColumn item = AddConsumableInfoColumn(list[k].ConsumableId, list[k], on_load_consumable_info, get_value_consumable_info, on_click_consumable_info, set_value_consumable_info, compare_consumable_info, on_tooltip_consumable_info, on_tooltip_sort_consumable_info);
                list2.Add(item);
                num = list[k].MajorOrder;
                list4.Add(item);
            }
        }
        AddSuperCheckboxColumn("SuperCheckConsumable", list2.ToArray(), base.on_load_value_checkbox_column_super, get_value_checkbox_column_super, base.on_press_checkbox_column_super, base.set_value_checkbox_column_super, null, on_tooltip_consumable_info_super);
    }