Esempio n. 1
0
        public static void ContractProlong(Pawn pawn, float chance)
        {
            if (Rand.Value < chance)
            {
                Tenant tenantComp = pawn.TryGetComp <Tenant>();
                if (tenantComp.AutoRenew)
                {
                    tenantComp.ContractDate    = Find.TickManager.TicksGame;
                    tenantComp.ContractEndDate = Find.TickManager.TicksAbs + tenantComp.ContractLength + 60000;
                    tenantComp.ResetMood();
                    Utility.MakePayment(pawn);

                    string letterLabel = "ContractNew".Translate();
                    string letterText  = "ContractRenewedMessage".Translate(pawn.Named("PAWN"));
                    Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.PositiveEvent);
                    return;
                }
                string  text    = Utility.ProlongContractMessage(pawn);
                DiaNode diaNode = new DiaNode(text);
                //Accepted offer.
                DiaOption diaOption = new DiaOption("ContractAgree".Translate())
                {
                    action = delegate {
                        Utility.MakePayment(pawn);
                        tenantComp.ContractDate    = Find.TickManager.TicksGame;
                        tenantComp.ContractEndDate = Find.TickManager.TicksAbs + tenantComp.ContractLength + 60000;
                        tenantComp.ResetMood();
                    },
                    resolveTree = true,
                };
                diaNode.options.Add(diaOption);
                //Denied offer
                string    text2      = "RequestForTenancyContinuedRejected".Translate(pawn.LabelShort, pawn, pawn.Named("PAWN"));
                DiaNode   diaNode2   = new DiaNode(text2);
                DiaOption diaOption2 = new DiaOption("OK".Translate())
                {
                    resolveTree = true
                };
                diaNode2.options.Add(diaOption2);
                DiaOption diaOption3 = new DiaOption("ContractReject".Translate())
                {
                    action = delegate {
                        TenantLeave(pawn);
                    },
                    link = diaNode2
                };
                diaNode.options.Add(diaOption3);
                string title = "RequestForTenancyTitle".Translate(pawn.Map.Parent.Label);
                Find.WindowStack.Add(new Dialog_NodeTree(diaNode, delayInteractivity: true, radioMode: true, title));
                Find.Archive.Add(new ArchivedDialog(diaNode.text, title));
            }
            else
            {
                TenantLeave(pawn);
            }
        }
Esempio n. 2
0
 public static void GenerateBasicTenancyContract(Tenant tenantComp)
 {
     tenantComp.Payment         = Rand.Range(SettingsHelper.LatestVersion.MinDailyCost, SettingsHelper.LatestVersion.MaxDailyCost);
     tenantComp.ContractLength  = Rand.Range(SettingsHelper.LatestVersion.MinContractTime, SettingsHelper.LatestVersion.MaxContractTime) * 60000;
     tenantComp.ContractDate    = Find.TickManager.TicksGame;
     tenantComp.ContractEndDate = Find.TickManager.TicksAbs + tenantComp.ContractLength + 60000;
     tenantComp.ResetMood();
 }