Пример #1
0
 /// <summary>
 /// Tries to get a handle on Child2NPC's IsChildNPC.
 /// </summary>
 /// <returns>True if successful, false otherwise.</returns>
 internal static bool GetIsChildToNPC()
 {
     if (ModRegistry.Get("Loe2run.ChildToNPC") is null)
     {
         ModMonitor.Log($"Child2NPC not installed - no need to adjust for that.", LogLevel.Trace);
         return(false);
     }
     if (Type.GetType("ChildToNPC.ModEntry, ChildToNPC")?.GetMethod("IsChildNPC", new Type[] { typeof(Character) }) is MethodInfo childToNPCMethod)
     {
         IsChildToNPC = childToNPCMethod.CreateDelegate <Func <NPC, bool> >();
         return(true);
     }
     ModMonitor.Log("IsChildNPC method not found - integration with Child2NPC failed.", LogLevel.Warn);
     return(false);
 }