Exemple #1
0
        // Token: 0x0600003F RID: 63 RVA: 0x00004A60 File Offset: 0x00002C60
        public static bool GenDrugResponse(bool isDR, Pawn pawn, HediffDef hdef, ThingDef drugDef = null, BodyPartRecord part = null, List <string> Master = null, int num = 1)
        {
            bool result = false;

            if (drugDef != null)
            {
                if (MSAddDrugBill.GenMSRecipe(pawn, hdef, drugDef, part))
                {
                    result = true;
                }
            }
            else if (isDR)
            {
                string Hdefname = hdef?.defName;
                if (Hdefname != null)
                {
                    string drugdefname = MSDRUtility.GetValueDRDrug(Hdefname, Master, num);
                    if (drugdefname != null)
                    {
                        drugDef = DefDatabase <ThingDef> .GetNamed(drugdefname, false);

                        if (drugDef != null && MSAddDrugBill.GenMSRecipe(pawn, hdef, drugDef, part))
                        {
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
        // Token: 0x0600006D RID: 109 RVA: 0x000069D0 File Offset: 0x00004BD0
        public static bool CheckIfResponse(Pawn pawn, string hdefname, List <string> ResponseList, int num, out ThingDef drugdef)
        {
            bool result = false;

            drugdef = null;
            string drugdefname;

            if (num < 2)
            {
                drugdefname = MSDRUtility.GetValueDRDrug(hdefname, DRSettings.MSDRValues, num);
            }
            else
            {
                drugdefname = MSDRUtility.GetValueDRDrug(hdefname, DRSettings.MSDRValues2, num);
            }
            if (drugdefname != null)
            {
                int ticksDR;
                if (num < 2)
                {
                    ticksDR = MSDRUtility.GetValueDRTime(hdefname, DRSettings.MSDRValues, num) * 2500;
                }
                else
                {
                    ticksDR = MSDRUtility.GetValueDRTime(hdefname, DRSettings.MSDRValues2, num) * 2500;
                }
                int lasttick = MSPainlessData.GetDRResponseLastTick(pawn, hdefname, ResponseList, num);
                if (lasttick > 0)
                {
                    if (lasttick + ticksDR < Find.TickManager.TicksGame)
                    {
                        result = true;
                    }
                }
                else
                {
                    result = true;
                }
            }
            if (result)
            {
                ThingDef chkdef = DefDatabase <ThingDef> .GetNamed(drugdefname, false);

                if (chkdef != null)
                {
                    drugdef = chkdef;
                }
                else
                {
                    result = false;
                    Log.Message(string.Concat(new string[]
                    {
                        "Warning DR: Missing ThingDef for ",
                        drugdefname,
                        " as response to malady ",
                        hdefname,
                        "(Possible mod list change)"
                    }), false);
                }
            }
            return(result);
        }