コード例 #1
0
            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);
            }
コード例 #2
0
            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");
            }