public static void Postfix(SimGameState __instance, GameInstanceSave gameInstanceSave, ref List <Contract> ___globalContracts) { SimGameSave save = gameInstanceSave.SimGameSave; if (!save.GlobalReferences.HasItem(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY)) { return; } Contract selectedContract = save.GlobalReferences.GetItem <Contract>(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY); if (selectedContract == null) { return; } //LanceConfiguration lastLance = Traverse.Create(__instance).Method("GetLastLance").GetValue<LanceConfiguration>(); //selectedContract.SetLanceConfiguration(lastLance); //selectedContract.Override.disableLanceConfiguration = false; selectedContract.Override.disableNegotations = true; selectedContract.Override.disableCancelButton = true; selectedContract.Override.negotiatedSalary = selectedContract.PercentageContractValue; selectedContract.Override.negotiatedSalvage = selectedContract.PercentageContractSalvage; __instance.SetSelectedContract(selectedContract); }
public static void Prefix(SimGameState __instance, SimGameSave save, ref SerializableReferenceContainer references) { Contract selectedContract = __instance.SelectedContract; // TODO check we're in simGame, not combat! if (selectedContract == null || __instance.BattleTechGame.Combat != null) { return; } LanceConfiguration lastLance = Traverse.Create(__instance).Method("GetLastLance").GetValue <LanceConfiguration>(); selectedContract.SetLanceConfiguration(lastLance); selectedContract.SetCarryOverNegotationValues(true); selectedContract.Accept(true); selectedContract.Override.disableNegotations = true; Contract travelContract = createTravelContract(selectedContract); Logger.Minimal("created travelcontract with name: " + travelContract.Name); __instance.PrepareBreadcrumb(travelContract); // __instance.SetSelectedContract(travelContract, true); //references.AddItem(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY, travelContract); //references.AddItem("activeBreadcrumb", travelContract); Logger.Minimal("saving selected contract: " + travelContract.GUID); //references.AddItemList<Contract>("globalContracts", new List<Contract>() { selectedContract }); //this.globalContracts = globalReferences.GetItemList<Contract>("globalContracts"); }
public static void Postfix(SimGameState __instance, GameInstanceSave gameInstanceSave) { SimGameSave save = gameInstanceSave.SimGameSave; if (!save.GlobalReferences.HasItem(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY)) { return; } Contract selectedContract = save.GlobalReferences.GetItem <Contract>(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY); if (selectedContract == null) { return; } // __instance.SetSelectedContract(selectedContract); //Traverse.Create(__instance).Field("activeBreadcrumb").SetValue(selectedContract); Logger.Minimal("loaded selected Contract: " + selectedContract.Name); Logger.Minimal("selected contract accepted: " + selectedContract.Accepted); Logger.Minimal("selected contract can negogiate : " + selectedContract.CanNegotiate); Logger.Minimal("selected contract carry over negotiate values : " + selectedContract.CarryOverNegotationValues); Logger.Minimal("selected contract cbills: " + selectedContract.PercentageContractValue); Logger.Minimal("selected contract salvage: " + selectedContract.PercentageContractSalvage); Logger.Minimal("selected contract rep: " + selectedContract.PercentageContractReputation); //__instance.PrepareBreadcrumb(selectedContract); selectedContract.Accept(true); }
public static void Prefix(SimGameState __instance, SimGameSave save, ref SerializableReferenceContainer references) { Contract selectedContract = __instance.SelectedContract; if (selectedContract == null || __instance.BattleTechGame.Combat != null) { return; } references.AddItem(ModSettings.MOD_SAVE_REFERENCECONTAINER_KEY, selectedContract); }
public static void Postfix(SimGameState __instance, GameInstanceSave gameInstanceSave) { SimGameSave save = gameInstanceSave.SimGameSave; List <string> debugLines = new List <string>(); if (save.ActiveContractName != null) { Logger.Minimal("active contract not null"); __instance.SetSelectedContract(save.GlobalContracts[0]); } }