コード例 #1
0
 public static DiaNode MakeExtortionRejectedInsultedNode(ProblemWorker_Hacker problemWorker)
 {
     return(new DiaNode("PH_Extortion_Insult_Title".Translate())
     {
         text = "PH_Extortion_Insult_Text".Translate(),
         options =
         {
             new DiaOption("(" + "Disconnect".Translate() + ")")
             {
                 resolveTree = true
             }
         }
     });
 }
コード例 #2
0
        //[DebuggerHidden]
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ProblemWorker_Hacker pw = GetProblemWorker();

            if (pw == null)
            {
                yield break;
            }
            this.AddEndCondition(() => pw.IsRunning() && !pw.HasHackingStopped() && (TargetThingA.TryGetComp <CompHacked>()?.investigatable ?? false)
                                ? JobCondition.Ongoing : JobCondition.Incompletable);
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil doWork = new Toil().FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);

            doWork.initAction = () => {
                this.totalWorkNeeded = 300f;
                this.workLeft        = this.totalWorkNeeded;
            };
            doWork.tickAction = () => {
                this.workLeft -= this.pawn.GetStatValue(StatDefOf.ResearchSpeed, true);
                this.pawn.skills.GetSkill(SkillDefOf.Intellectual).Learn(5f, false);
                if (this.workLeft <= 0f)
                {
                    doWork.actor.jobs.curDriver.ReadyForNextToil();
                }
            };
            doWork.defaultCompleteMode = ToilCompleteMode.Never;
            doWork.WithProgressBar(TargetIndex.A, () => 1f - this.workLeft / this.totalWorkNeeded, false, -0.5f);
            yield return(doWork);

            Toil foundEm = new Toil();

            foundEm.defaultCompleteMode = ToilCompleteMode.Instant;
            foundEm.initAction          = delegate {
                ResearchProjectDef current = Find.ResearchManager.currentProj;
                Find.ResearchManager.currentProj = DefDatabase <ResearchProjectDef> .GetNamed("HackingCountermeasures");

                Find.ResearchManager.ResearchPerformed(500 / 0.007f, null);                     //Constant from inside ResearchManager
                Find.ResearchManager.currentProj = current;
                this.pawn.skills.GetSkill(SkillDefOf.Intellectual).Learn(500f, false);
                TargetThingA.TryGetComp <CompHacked>().investigatable = false;
                Find.LetterStack.ReceiveLetter("ProblemHackerInvestigateHackingLetterLabel".Translate(),
                                               "ProblemHackerInvestigateHackingLetterText".Translate(this.pawn.NameStringShort), LetterDefOf.PositiveEvent);
            };
            yield return(foundEm);
        }
コード例 #3
0
 public static DiaNode MakeExtortionAcceptedNode(ProblemWorker_Hacker problemWorker)
 {
     return(new DiaNode("ProblemHackerExtortionAccepted".Translate())
     {
         text = "ProblemHackerExtortionAcceptedText".Translate(problemWorker.hacker.Name),
         options =
         {
             new DiaOption("(" + "Disconnect".Translate() + ")")
             {
                 resolveTree = true,
                 action = delegate{
                     TradeUtility.LaunchSilver(problemWorker.rootMap, problemWorker.currentExtortionAmount);
                 }
             }
         }
     });
 }
コード例 #4
0
        public static DiaNode MakeContactHackedAllyBaseRootNode(ProblemWorker_Hacker problemWorker)
        {
            DiaNode node = new DiaNode("ProblemHackerHackedAllyBaseRootNodeTitle".Translate(problemWorker.alliedBase.Name))
            {
                text = "ProblemHackerHackedAllyBaseRootNodeText".Translate(),
            };

            if (problemWorker.foundHackingSite)
            {
                node.options.Add(new DiaOption("ProblemHackerHackedAllyBaseOption_OfferInformation".Translate())
                {
                    link = new DiaNode("ProblemHackerHackedAllyBase_OfferedInformationNodeTitle".Translate())
                    {
                        text    = "ProblemHackerHackedAllyBase_OfferedInformationNodeText".Translate(),
                        options =
                        {
                            new DiaOption("(" + "disconnect".Translate() + ")")
                            {
                                resolveTree = true
                            }
                        }
                    }
                });
            }
            else
            {
                node.options.Add(new DiaOption("ProblemHackerHackedAllyBaseOption_AskForInformation".Translate())
                {
                    link = new DiaNode("ProblemHackerHackedAllyBase_AskedForInformationNodeTitle".Translate())
                    {
                        text    = "ProblemHackerHackedAllyBase_AskedForInformationNodeText".Translate(),
                        options =
                        {
                            new DiaOption("(" + "disconnect".Translate() + ")")
                            {
                                resolveTree = true
                            }
                        }
                    }
                });
            }
            return(node);
        }
コード例 #5
0
        //[DebuggerHidden]
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ProblemWorker_Hacker pw = GetProblemWorker();

            if (pw == null)
            {
                yield break;
            }
            this.AddEndCondition(() => pw.IsRunning() && !pw.HasHackingStopped() && TargetThingA.TryGetComp <CompHacked>() != null
                                ? JobCondition.Ongoing : JobCondition.Incompletable);
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil doWork = new Toil().FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);

            doWork.initAction = () => {
                this.totalWorkNeeded = 100f;
                this.workLeft        = this.totalWorkNeeded;
            };
            doWork.tickAction = () => {
                this.workLeft -= this.pawn.GetStatValue(StatDefOf.ResearchSpeed, true);
                this.pawn.skills.GetSkill(SkillDefOf.Intellectual).Learn(5f, false);
                if (this.workLeft <= 0f)
                {
                    doWork.actor.jobs.curDriver.ReadyForNextToil();
                }
            };
            doWork.defaultCompleteMode = ToilCompleteMode.Never;
            doWork.WithProgressBar(TargetIndex.A, () => 1f - this.workLeft / this.totalWorkNeeded, false, -0.5f);
            yield return(doWork);

            Toil foundEm = new Toil();

            foundEm.defaultCompleteMode = ToilCompleteMode.Instant;
            foundEm.initAction          = delegate {
                FindExt.DynamicComponentManager.RemoveDynamicThingComp <CompHacked> (TargetThingA as ThingWithComps);
            };
            yield return(foundEm);
        }
コード例 #6
0
 public static DiaNode MakeExtortionRootNode(ProblemWorker_Hacker problemWorker)
 {
     return(new DiaNode("ProblemHackerExtortionDemands".Translate())
     {
         text = (problemWorker.alliedBase != null) ? "ProblemHackerExtortionDemandsText".Translate(problemWorker.alliedBase.Name, problemWorker.hacker.Name, problemWorker.currentExtortionAmount) :
                "ProblemHackerExtortionDemandsTextNoAllies".Translate(problemWorker.hacker.Name, problemWorker.currentExtortionAmount),
         options =
         {
             new DiaOption("ProblemHackerDialogOptionText_ExtortionRootNode_AcceptExtortion".Translate())
             {
                 linkLateBind = delegate{
                     problemWorker.ExtortionAccepted();
                     return MakeExtortionAcceptedNode(problemWorker);
                 },
                 disabled = !problemWorker.PlayerHasExtortionAmount(),
                 disabledReason = "NeedSilverLaunchable".Translate(problemWorker.currentExtortionAmount.ToString())
             },
             new DiaOption("ProblemHackerDialogOptionText_ExtortionRootNode_RejectExtortion".Translate())
             {
                 linkLateBind = delegate{
                     problemWorker.ExtortionRejected();
                     return MakeExtortionRejectedNode(problemWorker);
                 }
             },
             new DiaOption("ProblemHackerDialogOptionText_ExtortionRootNode_Threaten".Translate(problemWorker.hacker.NameStringShort))
             {
                 linkLateBind = delegate{
                     problemWorker.ExtortionRejectedInsulted();
                     return MakeExtortionRejectedInsultedNode(problemWorker);
                 }
             },
             new DiaOption("ProblemHackerDialogOptionText_ExtortionRootNode_Ignore".Translate())
             {
                 resolveTree = true
             }
         }
     });
 }
コード例 #7
0
 public ExtortionCommunication(ProblemWorker_Hacker pw) : base(pw.rootMap.uniqueID)
 {
     this.pw = pw;
 }
コード例 #8
0
 public HackedAllyFactionCommunication(ProblemWorker_Hacker pw) : base(pw.ID)
 {
     this.pw = pw;
 }
コード例 #9
0
 public ContactHackedAllyBase(ProblemWorker_Hacker pw) : base(pw.rootMap.uniqueID)
 {
     this.pw = pw;
 }
コード例 #10
0
 public WeakContactAttempt(ProblemWorker_Hacker pw) : base(pw.rootMap.uniqueID)
 {
     this.pw = pw;
 }