public static void RecordsTrackerPostLoadInit(Pawn_RecordsTracker recordTracker) { if (VersionControl.MajorFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) == 0 && VersionControl.MajorFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) <= 17 && Find.TaleManager.AnyTaleConcerns(recordTracker.pawn)) { recordTracker.AccumulateStoryEvent(StoryEventDefOf.TaleCreated); } }
public static void IncrementPostfix(Pawn_RecordsTracker __instance, RecordDef def) { if (def == RecordDefOf.Kills) { Pawn p = __instance.pawn; if (p != null && p.isBloodable() && p.BloodStatus() is Comp_Yautja _Yautja) { if (p.CurBloodStatus() == AvPExtensions.BloodStatusMode.None) { p.health.AddHediff(YautjaDefOf.RRY_Hediff_Unblooded); } _Yautja.CalcTick(); } if (p.isYautja()) { List <Thought_Memory> _Memories = p.needs.mood.thoughts.memories.Memories.FindAll(x => x.def == YautjaDefOf.RRY_Thought_ThrillOfTheHunt); if (_Memories.Count < YautjaDefOf.RRY_Thought_ThrillOfTheHunt.stackLimit) { p.needs.mood.thoughts.memories.Memories.Add(new Thought_Memory() { def = YautjaDefOf.RRY_Thought_ThrillOfTheHunt }); } } } }
// Token: 0x06000005 RID: 5 RVA: 0x000020B4 File Offset: 0x000002B4 public override void PawnDied(Corpse corpse) { float value = (float)corpse.InnerPawn.ageTracker.AgeBiologicalYears; float value2 = (float)corpse.InnerPawn.ageTracker.AgeChronologicalYears; Name name = corpse.InnerPawn.Name; Pawn_PlayerSettings playerSettings = corpse.InnerPawn.playerSettings; Pawn_TrainingTracker training = corpse.InnerPawn.training; Pawn_HealthTracker health = corpse.InnerPawn.health; Pawn_RecordsTracker records = corpse.InnerPawn.records; Pawn_RelationsTracker relations = corpse.InnerPawn.relations; Pawn_SkillTracker skills = corpse.InnerPawn.skills; Faction faction = corpse.InnerPawn.Faction; Comp_TimeLord timeLord = corpse.InnerPawn.TryGetComp <Comp_TimeLord>(); if (timeLord != null) { if (timeLord.TimesRegenerated < 13) { int regens = timeLord.TimesRegenerated; regens++; Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(corpse.InnerPawn.kindDef, faction, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 0f, false, false, false, false, false, false, false, false, 0, null, 1, null, null, null)); pawn.TryGetComp <Comp_TimeLord>().TimesRegenerated = regens; GenSpawn.Spawn(pawn, corpse.Position, corpse.Map, Rot4.Random); pawn.Name = name; pawn.relations = relations; pawn.training = training; pawn.records = records; pawn.skills = skills; pawn.playerSettings = playerSettings; corpse.Destroy(0); } } }
public static float getCuMWorth(this Pawn_RecordsTracker tracker) { if (tracker == null) { return(0); } float points = 0; foreach (RecordDef d in DefDatabase <RecordDef> .AllDefsListForReading) { points += tracker.GetValue(d) * QOLMod.getCuMRecordFactor(d); } return(points); }
/// <summary> /// Increment Event where Records are incremented by 1 /// </summary> /// <param name="def"></param> /// <param name="__instance"></param> public static void RecordEvent(RecordDef def, Pawn_RecordsTracker __instance) { foreach (var card in AchievementPointManager.GetCards <RecordEventTracker>()) { try { if ((card.tracker as RecordEventTracker).Trigger(def, __instance.pawn)) { card.UnlockCard(); } } catch (Exception ex) { Log.Error($"Unable to trigger event for card validation. To avoid further errors {card.def.LabelCap} has been automatically unlocked.\n\nException={ex.Message}"); card.UnlockCard(); } } }
public static void Postfix(RecordDef def, float value, ref Pawn_RecordsTracker __instance) { if (def != RecordDefOf.NutritionEaten) { return; } if (!PicnicArea.VerifyPicnicSpot(__instance.pawn)) { return; } if (!PicnicArea.VerifyPicnicConditions(__instance.pawn.Map)) { return; } __instance.pawn.needs.mood?.thoughts.memories.TryGainMemory(PicnicAreaThoughtDefOf.AteAtPicnicArea); }
public static bool get_BattleActive(Pawn_RecordsTracker __instance, ref Battle __result) { if (battleExitTick(__instance) < Find.TickManager.TicksGame) { __result = null; return(false); } if (battleActive == null) { __result = null; return(false); } while (battleActive(__instance).AbsorbedBy != null) { battleActive(__instance) = battleActive(__instance).AbsorbedBy; } __result = battleActive(__instance); return(false); }
public override void PostExposeData(object obj) { if (Scribe.mode == LoadSaveMode.LoadingVars) { Game game = obj as Game; if (game != null && game.battleLog == null) { game.battleLog = new BattleLog(); } BattleLogEntry_MeleeCombat battleLogEntry_MeleeCombat = obj as BattleLogEntry_MeleeCombat; if (battleLogEntry_MeleeCombat != null) { if (battleLogEntry_MeleeCombat.RuleDef == null) { RulePackDef value = null; RulePackDef value2 = null; Scribe_Defs.Look(ref value, "outcomeRuleDef"); Scribe_Defs.Look(ref value2, "maneuverRuleDef"); if (value != null && value2 != null) { foreach (RulePackDef item in DefDatabase <RulePackDef> .AllDefsListForReading) { if (!item.include.NullOrEmpty() && item.include.Count == 2 && ((item.include[0] == value && item.include[1] == value2) || (item.include[1] == value && item.include[0] == value2))) { battleLogEntry_MeleeCombat.RuleDef = item; break; } } } } if (battleLogEntry_MeleeCombat.def == null) { battleLogEntry_MeleeCombat.def = LogEntryDefOf.MeleeAttack; } } } if (Scribe.mode == LoadSaveMode.PostLoadInit) { Map map = obj as Map; if (map != null && map.pawnDestinationReservationManager == null) { map.pawnDestinationReservationManager = new PawnDestinationReservationManager(); } Pawn pawn = obj as Pawn; if (pawn != null && pawn.Spawned && pawn.rotationTracker == null) { pawn.rotationTracker = new Pawn_RotationTracker(pawn); } Pawn_MindState pawn_MindState = obj as Pawn_MindState; if (pawn_MindState != null && pawn_MindState.inspirationHandler == null) { pawn_MindState.inspirationHandler = new InspirationHandler(pawn_MindState.pawn); } ImportantPawnComp importantPawnComp = obj as ImportantPawnComp; if (importantPawnComp != null && importantPawnComp.pawn == null) { importantPawnComp.pawn = new ThingOwner <Pawn>(importantPawnComp, oneStackOnly: true); } Pawn_RecordsTracker pawn_RecordsTracker = obj as Pawn_RecordsTracker; if (pawn_RecordsTracker != null && Find.TaleManager.AnyTaleConcerns(pawn_RecordsTracker.pawn)) { pawn_RecordsTracker.AccumulateStoryEvent(StoryEventDefOf.TaleCreated); } WorldPawns worldPawns = obj as WorldPawns; if (worldPawns != null && worldPawns.gc == null) { worldPawns.gc = new WorldPawnGC(); } GameCondition gameCondition = obj as GameCondition; if (gameCondition != null && !gameCondition.Permanent && gameCondition.Duration > 1000000000) { gameCondition.Permanent = true; } Building_TurretGun building_TurretGun = obj as Building_TurretGun; if (building_TurretGun != null && building_TurretGun.gun == null) { building_TurretGun.MakeGun(); } } }
/// <summary> /// Additional Patch to AddTo to catch outside calls to increment the non Time-based RecordDef /// </summary> /// <param name="def"></param> /// <param name="__instance"></param> public static void RecordAddToEvent(RecordDef def, Pawn_RecordsTracker __instance) { RecordEvent(def, __instance); }