public static void PostFix(Pawn __instance, TradeAction action, Pawn playerNegotiator) { if (action == TradeAction.PlayerSells) { if (__instance.RaceProps.Humanlike) { Handler_PawnSold.HandlePawnSold_ByTrade(__instance, playerNegotiator); } } }
public static void SignalRelevantHandlers(Pawn __instance, TradeAction action, Pawn playerNegotiator) { if (action != TradeAction.PlayerSells) { return; } if (__instance.RaceProps.Humanlike) { Handler_PawnSold.HandlePawnSold_ByTrade(__instance, playerNegotiator); } }
public static bool PreFix(Pawn_RelationsTracker __instance, Pawn playerNegotiator) { // Find out the underlying pawn of this tracker exhausively foreach (Pawn potential in Find.WorldPawns.AllPawnsAlive) { if (potential.relations == __instance) { Handler_PawnSold.HandlePawnSold_ByTrade(potential, playerNegotiator); return(false); } } DesynchronizedMain.LogError("Failed to determine owner of Pawn_RelationsTracker. Falling back to vanilla behavior."); return(true); }
public static void PostFix(TransportPodsArrivalAction_GiveGift __instance, List <ActiveDropPodInfo> pods) { Map mapOfSender = DesynchronizedMain.ArrivalActionAndSenderLinker.SafelyGetMapOfGivenAction(__instance); for (int i = 0; i < pods.Count; i++) { for (int j = 0; j < pods[i].innerContainer.Count; j++) { Pawn victim = pods[i].innerContainer[j] as Pawn; if (victim != null && victim.RaceProps.Humanlike) { Handler_PawnSold.HandlePawnSold_ByGiftingViaPods(victim, mapOfSender); } } } }
public static bool SignalRelevantHandlers(Pawn_RelationsTracker __instance, Pawn playerNegotiator) { foreach (Pawn potential in Find.WorldPawns.AllPawnsAlive) { /* * Reversed method for finding the victim. * If RelationsTracker -> pawn does not work, then let's do pawn -> RelationsTracker */ if (potential.relations == __instance) { Handler_PawnSold.HandlePawnSold_ByTrade(potential, playerNegotiator); return(false); } } DesynchronizedMain.LogError("Failed to determine owner of Pawn_RelationsTracker. Falling back to vanilla behavior."); return(true); }