From 29550bbbf09cbb3b9cb7ddae50a340db6babb4b9 Mon Sep 17 00:00:00 2001 From: Alex Tearse-Doyle Date: Sat, 17 Nov 2018 01:45:32 -0800 Subject: [PATCH] restore pharamacist compat --- Source/GetPawnMedicalCareCategory.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Source/GetPawnMedicalCareCategory.cs b/Source/GetPawnMedicalCareCategory.cs index 4dedce5..50b2846 100644 --- a/Source/GetPawnMedicalCareCategory.cs +++ b/Source/GetPawnMedicalCareCategory.cs @@ -15,18 +15,28 @@ static class GetPawnMedicalCareCategory static MethodInfo pharmacistTendAdvice; static GetPawnMedicalCareCategory() { + Log.Message($"Trying to find Pharmacist"); Type pharmacist = AccessTools.TypeByName("Pharmacist.PharmacistUtility"); if (pharmacist == null) return; - pharmacistTendAdvice = AccessTools.Method(pharmacist, "TendAdvice"); + pharmacistTendAdvice = AccessTools.Method(pharmacist, "TendAdvice", new Type[] { typeof(Pawn)}); + Log.Message($"Pharmacist type is {pharmacist}, advice is {pharmacistTendAdvice}"); } public static MedicalCareCategory GetCare(this Pawn pawn) { + MedicalCareCategory care; if (pharmacistTendAdvice != null) - return (MedicalCareCategory)pharmacistTendAdvice.Invoke(pawn, new object[] { }); - - return pawn.playerSettings?.medCare ?? MedicalCareCategory.NoCare; + { + care = (MedicalCareCategory)pharmacistTendAdvice.Invoke(null, new object[] { pawn }); + Log.Message($"Pharmacist tend advicefor {pawn} is {care}"); + } + else + { + care = pawn.playerSettings?.medCare ?? MedicalCareCategory.NoCare; + Log.Message($"Care for {pawn} is {care}"); + } + return care; } } }