static bool Prefix(int idx, MechDef mech, bool active, bool forcePlacement, bool displayMechPopup, string mechAddedHeader, SimGameState __instance) { Logger.Debug("AddMech Prefix Patch Installed"); if (displayMechPopup) { if (string.IsNullOrEmpty(mech.GUID)) { mech.SetGuid(__instance.GenerateSimGameUID()); } var companyStats = Traverse.Create(__instance).Field("companyStats").GetValue <StatCollection>(); companyStats.ModifyStat <int>("Mission", 0, "COMPANY_MechsAdded", StatCollection.StatOperation.Int_Add, 1, -1, true); if (string.IsNullOrEmpty(mechAddedHeader)) { mechAddedHeader = "'Mech Chassis Complete"; int num = (int)WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_sim_popup_newChassis, WwiseManager.GlobalAudioObject, (AkCallbackManager.EventCallback)null, (object)null); } mechAddedHeader += ": {0}"; __instance.GetInterruptQueue().QueuePauseNotification( string.Format(mechAddedHeader, (object)mech.Description.UIName), mech.Chassis.YangsThoughts, __instance.GetCrewPortrait(SimGameCrew.Crew_Yang), "notification_mechreadycomplete", (Action)(() => { int firstFreeMechBay = __instance.GetFirstFreeMechBay(); if (firstFreeMechBay >= 0) { __instance.ActiveMechs[firstFreeMechBay] = mech; SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs); } else { __instance.CreateMechPlacementPopup(mech); } }), "Continue", (Action)null, (string)null); return(false); } return(true); }