Exemplo n.º 1
0
        public virtual void PostMapGenerate()
        {
            List <WorldObjectComp> allComps = base.AllComps;

            for (int i = 0; i < allComps.Count; i++)
            {
                allComps[i].PostMapGenerate();
            }
            QuestUtility.SendQuestTargetSignals(questTags, "MapGenerated", this.Named("SUBJECT"));
        }
Exemplo n.º 2
0
 public void ActivateQuest(Pawn accepter, QuestInfo questInfo)
 {
     Log.Message("1 questInfo.quest: " + questInfo.quest.State + " - " + questInfo.quest.initiallyAccepted);
     Find.QuestManager.Add(questInfo.quest);
     questInfo.quest.Accept(accepter);
     QuestUtility.SendLetterQuestAvailable(questInfo.quest);
     questInfo.currencyInfo?.Buy(questInfo);
     availableQuests.Remove(questInfo);
     Log.Message("2 questInfo.quest: " + questInfo.quest.State + " - " + questInfo.quest.initiallyAccepted);
 }
Exemplo n.º 3
0
        public virtual void Notify_MyMapRemoved(Map map)
        {
            List <WorldObjectComp> allComps = base.AllComps;

            for (int i = 0; i < allComps.Count; i++)
            {
                allComps[i].PostMyMapRemoved();
            }
            QuestUtility.SendQuestTargetSignals(questTags, "MapRemoved", this.Named("SUBJECT"));
        }
Exemplo n.º 4
0
        public static bool Do()
        {
            var root = DefDatabase <QuestScriptDef> .GetNamed("Reunion_AllyChased");

            var points = StorytellerUtility.DefaultThreatPointsNow(Current.Game.AnyPlayerHomeMap);

            QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(root, points));

            return(true);
        }
Exemplo n.º 5
0
        protected override void RunInt()
        {
            string processedTag = GetProcessedTag(QuestGen.slate);

            QuestUtility.AddQuestTag(ref QuestGen.quest.tags, processedTag);
            if (storeProcessedTagAs.GetValue(QuestGen.slate) != null)
            {
                QuestGen.slate.Set(storeProcessedTagAs.GetValue(QuestGen.slate), processedTag);
            }
        }
Exemplo n.º 6
0
        public static Thing SpawnTunnels(ThingDef hiveDef, int hiveCount, Map map, IntVec3 cell, bool spawnAnywhereIfNoGoodCell = false, bool ignoreRoofedRequirement = false, string questTag = null, Faction faction = null)
        {
            ThingDef         HiveDef   = hiveDef ?? RimWorld.ThingDefOf.Hive;
            HiveDefExtension HiveExt   = HiveDef.GetModExtension <HiveDefExtension>();
            ThingDef         TunnelDef = HiveExt?.TunnelDef ?? RimWorld.ThingDefOf.TunnelHiveSpawner;
            HiveDefExtension extension = HiveDef.GetModExtension <HiveDefExtension>();

            if (extension != null && extension.TunnelDef != null)
            {
                TunnelDef = extension.TunnelDef;
            }
            Thing             thing       = GenSpawn.Spawn(ThingMaker.MakeThing(TunnelDef), cell, map, WipeMode.FullRefund);
            TunnelHiveSpawner hiveSpawner = thing as TunnelHiveSpawner;

            if (hiveSpawner != null)
            {
                if (hiveSpawner.faction == null && faction != null)
                {
                    hiveSpawner.faction = faction;
                }
            }
            if (hiveSpawner.SpawnedFaction != null)
            {
                //	Log.Message(hiveSpawner.Faction.def.defName + ": " + hiveSpawner.faction);
            }
            QuestUtility.AddQuestTag(thing, questTag);
            CompSpawnerHives spawnerHives = thing.TryGetComp <CompSpawnerHives>();

            if (spawnerHives?.Props.tunnelDef != null)
            {
                TunnelDef = spawnerHives.Props.tunnelDef;
            }
            for (int i = 0; i < hiveCount - 1; i++)
            {
                cell = CompSpawnerHives.FindChildHiveLocation(thing.Position, map, HiveDef, HiveDef.GetCompProperties <CompProperties_SpawnerHives>(), ignoreRoofedRequirement, allowUnreachable: true);
                if (cell.IsValid)
                {
                    thing       = GenSpawn.Spawn(ThingMaker.MakeThing(TunnelDef), cell, map, WipeMode.FullRefund);
                    hiveSpawner = thing as TunnelHiveSpawner;
                    if (hiveSpawner != null)
                    {
                        if (hiveSpawner.faction == null && faction != null)
                        {
                            hiveSpawner.faction = faction;
                        }
                    }
                    if (hiveSpawner.SpawnedFaction != null)
                    {
                        //	Log.Message(hiveSpawner.Faction.def.defName + ": " + hiveSpawner.faction);
                    }
                    QuestUtility.AddQuestTag(thing, questTag);
                }
            }
            return(thing);
        }
Exemplo n.º 7
0
 void AcceptQuest()
 {
     if (feedbackUpdater != null)
     {
         feedbackUpdater.ActivateQuestWaitingFeedback();
     }
     QuestUtility.AcceptQuest(questToGive);
     Debug.Log(questToGive.Objectives[0].Title);
     GameManager.Instance.Ui.goContentQuestParent.SetActive(false);
     CloseBox();
 }
Exemplo n.º 8
0
        void EndQuest()
        {
            CloseBox();
            if (feedbackUpdater != null)
            {
                feedbackUpdater.DisableFeedbacks();
            }
            QuestUtility.CompleteQuest(QuestToGive);

            // Do things?
        }
Exemplo n.º 9
0
 protected override bool TryExecuteWorker(IncidentParms parms)
 {
     // give quest - 1.1 ver!
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points));
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points));
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points));
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points));
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points));
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points));
     return(true);
 }
Exemplo n.º 10
0
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (Gizmo gizmo in base.GetGizmos())
     {
         yield return(gizmo);
     }
     foreach (Gizmo gizmo2 in QuestUtility.GetQuestRelatedGizmos(this))
     {
         yield return(gizmo2);
     }
     yield break;
 }
Exemplo n.º 11
0
        static void GenerateIntelQuest(Faction faction, string name, int goodwill)
        {
            Slate slate = new Slate();

            slate.Set("points", StorytellerUtility.DefaultThreatPointsNow(Find.World));
            slate.Set("asker", faction.leader);
            Quest newQuest = QuestUtility.GenerateQuestAndMakeAvailable(DefDatabase <QuestScriptDef> .GetNamed(name), slate);

            QuestUtility.SendLetterQuestAvailable(newQuest);
            faction.lastTraderRequestTick = Find.TickManager.TicksGame;
            faction.TryAffectGoodwillWith(Faction.OfPlayer, -goodwill, canSendMessage: false, canSendHostilityLetter: true, "GoodwillChangedReason_RequestedIntel".Translate());
        }
Exemplo n.º 12
0
 private static void AddSlateQuestTags()
 {
     for (int i = 0; i < slateQuestTagsToAddWhenFinished.Count; i++)
     {
         if (slate.TryGet <object>(slateQuestTagsToAddWhenFinished[i], out var var, isAbsoluteName: true))
         {
             string questTagToAdd = GenerateNewTargetQuestTag(slateQuestTagsToAddWhenFinished[i], ensureUnique: false);
             QuestUtility.AddQuestTag(var, questTagToAdd);
         }
     }
     slateQuestTagsToAddWhenFinished.Clear();
 }
        public static Vector2 PawnCardSize(Pawn pawn)
        {
            Vector2 basePawnCardSize = BasePawnCardSize;

            tmpInspectStrings.Length = 0;
            QuestUtility.AppendInspectStringsFromQuestParts(tmpInspectStrings, pawn, out int count);
            if (count >= 2)
            {
                basePawnCardSize.y += (count - 1) * 20;
            }
            return(basePawnCardSize);
        }
        private static List <object> GetWorkTypeDisableCauses(Pawn pawn, WorkTags workTag)
        {
            List <object> list = new List <object>();

            if (pawn.story != null && pawn.story.childhood != null && (pawn.story.childhood.workDisables & workTag) != 0)
            {
                list.Add(pawn.story.childhood);
            }
            if (pawn.story != null && pawn.story.adulthood != null && (pawn.story.adulthood.workDisables & workTag) != 0)
            {
                list.Add(pawn.story.adulthood);
            }
            if (pawn.health != null && pawn.health.hediffSet != null)
            {
                foreach (Hediff hediff in pawn.health.hediffSet.hediffs)
                {
                    HediffStage curStage = hediff.CurStage;
                    if (curStage != null && (curStage.disabledWorkTags & workTag) != 0)
                    {
                        list.Add(hediff);
                    }
                }
            }
            if (pawn.story.traits != null)
            {
                for (int i = 0; i < pawn.story.traits.allTraits.Count; i++)
                {
                    Trait trait = pawn.story.traits.allTraits[i];
                    if ((trait.def.disabledWorkTags & workTag) != 0)
                    {
                        list.Add(trait);
                    }
                }
            }
            if (pawn.royalty != null)
            {
                foreach (RoyalTitle item in pawn.royalty.AllTitlesForReading)
                {
                    if (item.conceited && (item.def.disabledWorkTags & workTag) != 0)
                    {
                        list.Add(item);
                    }
                }
            }
            foreach (QuestPart_WorkDisabled item2 in QuestUtility.GetWorkDisabledQuestPart(pawn))
            {
                if ((item2.disabledWorkTags & workTag) != 0 && !list.Contains(item2.quest))
                {
                    list.Add(item2.quest);
                }
            }
            return(list);
        }
Exemplo n.º 15
0
 internal void ClearMentalStateDirect()
 {
     if (curStateInt != null)
     {
         curStateInt = null;
         QuestUtility.SendQuestTargetSignals(pawn.questTags, "ExitMentalState", pawn.Named("SUBJECT"));
         if (pawn.Spawned)
         {
             pawn.Map.attackTargetsCache.UpdateTarget(pawn);
         }
     }
 }
Exemplo n.º 16
0
 protected virtual void UpdateTitle()
 {
     if (eventData == null)
     {
         SetLabelText((Enum)UI.LBL_ARENA_NAME, string.Empty);
         SetLabelText((Enum)UI.LBL_END_DATE, string.Empty);
     }
     else
     {
         SetLabelText((Enum)UI.LBL_ARENA_NAME, eventData.name);
         string endDateString = QuestUtility.GetEndDateString(eventData);
         SetLabelText((Enum)UI.LBL_END_DATE, endDateString);
     }
 }
Exemplo n.º 17
0
        public virtual void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            if (!allowDestroyNonDestroyable && !def.destroyable)
            {
                Log.Error("Tried to destroy non-destroyable thing " + this);
                return;
            }
            if (Destroyed)
            {
                Log.Error("Tried to destroy already-destroyed thing " + this);
                return;
            }
            bool spawned = Spawned;
            Map  map     = Map;

            if (Spawned)
            {
                DeSpawn(mode);
            }
            mapIndexOrState = -2;
            if (def.DiscardOnDestroyed)
            {
                Discard();
            }
            CompExplosive compExplosive = this.TryGetComp <CompExplosive>();

            if (spawned)
            {
                List <Thing> list = ((compExplosive != null) ? new List <Thing>() : null);
                GenLeaving.DoLeavingsFor(this, map, mode, list);
                compExplosive?.AddThingsIgnoredByExplosion(list);
            }
            if (holdingOwner != null)
            {
                holdingOwner.Notify_ContainedItemDestroyed(this);
            }
            RemoveAllReservationsAndDesignationsOnThis();
            if (!(this is Pawn))
            {
                stackCount = 0;
            }
            if (mode != DestroyMode.QuestLogic)
            {
                QuestUtility.SendQuestTargetSignals(questTags, "Destroyed", this.Named("SUBJECT"));
            }
            if (mode == DestroyMode.KillFinalize)
            {
                QuestUtility.SendQuestTargetSignals(questTags, "Killed", this.Named("SUBJECT"));
            }
        }
Exemplo n.º 18
0
 private void UpdateTitle()
 {
     if (!isExistArena)
     {
         SetLabelText((Enum)UI.LBL_ARENA_NAME, string.Empty);
         SetLabelText((Enum)UI.LBL_END_DATE, string.Empty);
     }
     else
     {
         SetLabelText((Enum)UI.LBL_ARENA_NAME, eventData.name);
         string endDateString = QuestUtility.GetEndDateString(eventData);
         SetLabelText((Enum)UI.LBL_END_DATE, endDateString);
     }
 }
 private void SetArenaName(Network.EventData nameEventData)
 {
     if (nameEventData == null)
     {
         SetLabelText((Enum)UI.LBL_ARENA_NAME, string.Empty);
         SetLabelText((Enum)UI.LBL_END_DATE, string.Empty);
     }
     else
     {
         SetLabelText((Enum)UI.LBL_ARENA_NAME, nameEventData.name);
         string endDateString = QuestUtility.GetEndDateString(nameEventData);
         SetLabelText((Enum)UI.LBL_END_DATE, endDateString);
     }
 }
        protected override void StrikeAction(ActiveArtilleryStrike strike, CellRect mapRect, CellRect baseRect, ref bool destroyed)
        {
            Log.Message(Site.AllComps.ToStringSafeEnumerable());
            var radialCells = GenRadial.RadialCellsAround(mapRect.RandomCell, strike.shellDef.projectile.explosionRadius, true);
            int cellsInRect = radialCells.Count(c => baseRect.Contains(c));

            // Destroy outpost and give reward
            if (cellsInRect > 0 && Rand.Chance(cellsInRect * DestroyChancePerCellInRect))
            {
                QuestUtility.SendQuestTargetSignals(Site.questTags, QuestUtility.QuestTargetSignalPart_AllEnemiesDefeated, Site.Named("SUBJECT"));
                NonPublicFields.Site_allEnemiesDefeatedSignalSent.SetValue(Site, true);
                Find.WorldObjects.Remove(worldObject);
                destroyed = true;
            }
        }
 public override bool TryStart(Pawn pawn, string reason, bool causedByMood)
 {
     TrySendLetter(pawn, "LetterRunWildMentalBreak", reason);
     QuestUtility.SendQuestTargetSignals(pawn.questTags, "RanWild", pawn.Named("SUBJECT"));
     pawn.ChangeKind(PawnKindDefOf.WildMan);
     if (pawn.Faction != null)
     {
         pawn.SetFaction(null);
     }
     pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.Catharsis);
     if (pawn.Spawned && !pawn.Downed)
     {
         pawn.jobs.StopAll();
     }
     return(true);
 }
    private void SetTime(Transform t, int milliSec)
    {
        string text = QuestUtility.CreateTimeStringByMilliSec(milliSec);
        bool   flag = QuestUtility.IsDefaultArenaTime(milliSec) && !isTotalTime;

        SetActive(t, UI.LBL_TIME, !flag);
        SetActive(t, UI.LBL_TIME_DEFAULT, flag);
        if (flag)
        {
            SetLabelText(t, UI.LBL_TIME_DEFAULT, text);
        }
        else
        {
            SetLabelText(t, UI.LBL_TIME, text);
        }
    }
Exemplo n.º 23
0
        public override void Execute()
        {
            QuestScriptDef scriptDef = DefDatabase <QuestScriptDef> .GetNamed("TKUtilsViewerRescue");

            float threatPoints = StorytellerUtility.DefaultSiteThreatPointsNow();

            var component = Current.Game.GetComponent <GameComponentPawns>();

            if (component != null && component.pawnHistory.ContainsKey(Viewer.username.ToLower()))
            {
                component.pawnHistory.Remove(Viewer.username.ToLower());
            }

            ViewerRescue.QueuedViewers.Enqueue(_report);
            QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(scriptDef, threatPoints));
            Viewer.Charge(storeIncident);
        }
Exemplo n.º 24
0
        public void MakeLords(IncidentParms parms, List <Pawn> pawns)
        {
            Map map = (Map)parms.target;
            List <List <Pawn> > list = IncidentParmsUtility.SplitIntoGroups(pawns, parms.pawnGroups);

            for (int i = 0; i < list.Count; i++)
            {
                List <Pawn> list2 = list[i];
                Lord        lord  = LordMaker.MakeNewLord(parms.faction, new LordJob_AssaultColonyWendigo(parms.faction), map, list2);
                lord.inSignalLeave = parms.inSignalEnd;
                QuestUtility.AddQuestTag(lord, parms.questTag);
                if (DebugViewSettings.drawStealDebug && parms.faction.HostileTo(Faction.OfPlayer))
                {
                    Log.Message("Market value threshold to start stealing (raiders=" + lord.ownedPawns.Count + "): " + StealAIUtility.StartStealingMarketValueThreshold(lord) + " (colony wealth=" + map.wealthWatcher.WealthTotal + ")");
                }
            }
        }
Exemplo n.º 25
0
 public virtual void PostRemove()
 {
     if (!def.useDynamicDrawer)
     {
         Find.World.renderer.Notify_StaticWorldObjectPosChanged();
     }
     if (def.useDynamicDrawer)
     {
         Find.WorldDynamicDrawManager.DeRegisterDrawable(this);
     }
     Find.WorldSelector.Deselect(this);
     for (int i = 0; i < comps.Count; i++)
     {
         comps[i].PostPostRemove();
     }
     QuestUtility.SendQuestTargetSignals(questTags, "Despawned", this.Named("SUBJECT"));
 }
        public override void WorldComponentTick()
        {
            base.WorldComponentTick();



            if (tickCounter > ticksToNextQuest)
            {
                Slate slate = new Slate();
                Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(InternalDefOf.GR_OpportunitySite_AbandonedLab, slate);

                QuestUtility.SendLetterQuestAvailable(quest);
                ticksToNextQuest = (int)(60000 * Rand.RangeInclusive(10, 30) * GeneticRim_Mod.settings.GR_QuestRate);
                tickCounter      = 0;
            }
            tickCounter++;
        }
Exemplo n.º 27
0
 public virtual void SetFaction(Faction newFaction, Pawn recruiter = null)
 {
     if (!def.CanHaveFaction)
     {
         Log.Error(string.Concat("Tried to SetFaction on ", this, " which cannot have a faction."));
         return;
     }
     factionInt = newFaction;
     if (Spawned)
     {
         IAttackTarget attackTarget = this as IAttackTarget;
         if (attackTarget != null)
         {
             Map.attackTargetsCache.UpdateTarget(attackTarget);
         }
     }
     QuestUtility.SendQuestTargetSignals(questTags, "ChangedFaction", this.Named("SUBJECT"), newFaction.Named("FACTION"));
 }
Exemplo n.º 28
0
 public virtual void Destroy()
 {
     if (Destroyed)
     {
         Log.Error("Tried to destroy already-destroyed world object " + this);
         return;
     }
     if (Spawned)
     {
         Find.WorldObjects.Remove(this);
     }
     destroyed = true;
     for (int i = 0; i < comps.Count; i++)
     {
         comps[i].PostDestroy();
     }
     QuestUtility.SendQuestTargetSignals(questTags, "Destroyed", this.Named("SUBJECT"));
 }
Exemplo n.º 29
0
 public WorldPawnSituation GetSituation(Pawn p)
 {
     if (!Contains(p))
     {
         return(WorldPawnSituation.None);
     }
     if (p.Dead || p.Destroyed)
     {
         return(WorldPawnSituation.Dead);
     }
     if (PawnUtility.IsFactionLeader(p))
     {
         return(WorldPawnSituation.FactionLeader);
     }
     if (PawnUtility.IsKidnappedPawn(p))
     {
         return(WorldPawnSituation.Kidnapped);
     }
     if (p.IsBorrowedByAnyFaction())
     {
         return(WorldPawnSituation.Borrowed);
     }
     if (p.IsCaravanMember())
     {
         return(WorldPawnSituation.CaravanMember);
     }
     if (PawnUtility.IsTravelingInTransportPodWorldObject(p))
     {
         return(WorldPawnSituation.InTravelingTransportPod);
     }
     if (PawnUtility.ForSaleBySettlement(p))
     {
         return(WorldPawnSituation.ForSaleBySettlement);
     }
     if (QuestUtility.IsReservedByQuestOrQuestBeingGenerated(p))
     {
         return(WorldPawnSituation.ReservedByQuest);
     }
     if (p.teleporting)
     {
         return(WorldPawnSituation.Teleporting);
     }
     return(WorldPawnSituation.Free);
 }
Exemplo n.º 30
0
 public void KillInnerPawn(bool affectFactionRelationship = false, Pawn affecter = null)
 {
     if (this.hasPawn)
     {
         Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDefOf.Colonist, Faction.OfPlayer));
         this.OverwritePawn(pawn);
         if (affectFactionRelationship)
         {
             this.faction.TryAffectGoodwillWith(affecter.Faction, -70, canSendMessage: true, canSendHostilityLetter: true,
                                                "AlteredCarbon.GoodwillChangedReason_ErasedPawn".Translate(pawn.Named("PAWN")), affecter);
             QuestUtility.SendQuestTargetSignals(pawn.questTags, "SurgeryViolation", pawn.Named("SUBJECT"));
         }
         if (isFactionLeader)
         {
             pawn.Faction.leader = pawn;
         }
         pawn.Kill(null);
     }
 }