Esempio n. 1
0
        public static ChoiceLetter MakeLetter(string label, string text, LetterDef def, GlobalTargetInfo lookTarget)
        {
            ChoiceLetter choiceLetter = LetterMaker.MakeLetter(label, text, def);

            choiceLetter.lookTarget = lookTarget;
            return(choiceLetter);
        }
        public static ChoiceLetter MakeLetter(string label, string text, LetterDef def, LookTargets lookTargets, Faction relatedFaction = null)
        {
            ChoiceLetter choiceLetter = LetterMaker.MakeLetter(label, text, def);

            choiceLetter.lookTargets    = lookTargets;
            choiceLetter.relatedFaction = relatedFaction;
            return(choiceLetter);
        }
Esempio n. 3
0
        public static ChoiceLetter MakeLetter(TaggedString label, TaggedString text, LetterDef def, LookTargets lookTargets, Faction relatedFaction = null, Quest quest = null, List <ThingDef> hyperlinkThingDefs = null)
        {
            ChoiceLetter choiceLetter = MakeLetter(label, text, def);

            choiceLetter.lookTargets        = lookTargets;
            choiceLetter.relatedFaction     = relatedFaction;
            choiceLetter.quest              = quest;
            choiceLetter.hyperlinkThingDefs = hyperlinkThingDefs;
            return(choiceLetter);
        }
Esempio n. 4
0
        public static ChoiceLetter MakeLetter(string label, string text, LetterDef def)
        {
            if (!typeof(ChoiceLetter).IsAssignableFrom(def.letterClass))
            {
                Log.Error(def + " is not a choice letter.");
                return(null);
            }
            ChoiceLetter choiceLetter = (ChoiceLetter)LetterMaker.MakeLetter(def);

            choiceLetter.label = label;
            choiceLetter.text  = text;
            return(choiceLetter);
        }
Esempio n. 5
0
        public static ChoiceLetter MakeLetter(TaggedString label, TaggedString text, LetterDef def, Faction relatedFaction = null, Quest quest = null)
        {
            if (!typeof(ChoiceLetter).IsAssignableFrom(def.letterClass))
            {
                Log.Error(string.Concat(def, " is not a choice letter."));
                return(null);
            }
            ChoiceLetter obj = (ChoiceLetter)MakeLetter(def);

            obj.label          = label;
            obj.text           = text;
            obj.relatedFaction = relatedFaction;
            obj.quest          = quest;
            return(obj);
        }
        public static ChoiceLetter MakeLetter(string label, string text, LetterDef def)
        {
            ChoiceLetter result;

            if (!typeof(ChoiceLetter).IsAssignableFrom(def.letterClass))
            {
                Log.Error(def + " is not a choice letter.", false);
                result = null;
            }
            else
            {
                ChoiceLetter choiceLetter = (ChoiceLetter)LetterMaker.MakeLetter(def);
                choiceLetter.label = label;
                choiceLetter.text  = text;
                result             = choiceLetter;
            }
            return(result);
        }
        public void ReceiveLetter(string label, string text, LetterDef textLetterDef, string debugInfo = null)
        {
            ChoiceLetter let = LetterMaker.MakeLetter(label, text, textLetterDef);

            this.ReceiveLetter(let, debugInfo);
        }
        public void ReceiveLetter(string label, string text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, string debugInfo = null)
        {
            ChoiceLetter let = LetterMaker.MakeLetter(label, text, textLetterDef, lookTargets, relatedFaction);

            this.ReceiveLetter(let, debugInfo);
        }
        public override void PostLoadSavegame(string loadingVersion)
        {
            oldCrashedShipParts.Clear();
            foreach (UpgradedCrashedShipPart upgradedCrashedShipPart in upgradedCrashedShipParts)
            {
                Thing   thing   = upgradedCrashedShipPart.thing;
                IntVec3 invalid = IntVec3.Invalid;
                Map     map     = null;
                if (thing.Spawned)
                {
                    invalid = thing.Position;
                    map     = thing.Map;
                }
                else
                {
                    Skyfaller obj = thing.ParentHolder as Skyfaller;
                    if (obj == null)
                    {
                        thing.Destroy();
                    }
                    invalid = obj.Position;
                    map     = obj.Map;
                }
                if (!(invalid == IntVec3.Invalid))
                {
                    invalid = new IntVec3(invalid.x - Mathf.CeilToInt((float)thing.def.size.x / 2f), invalid.y, invalid.z);
                    Thing item = null;
                    if (upgradedCrashedShipPart.originalDefName == "CrashedPoisonShipPart" || upgradedCrashedShipPart.originalDefName == "PoisonSpreaderShipPart")
                    {
                        item = ThingMaker.MakeThing(ThingDefOf.DefoliatorShipPart);
                    }
                    else if (upgradedCrashedShipPart.originalDefName == "CrashedPsychicEmanatorShipPart")
                    {
                        item = ThingMaker.MakeThing(ThingDefOf.PsychicDronerShipPart);
                    }
                    ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo();
                    activeDropPodInfo.innerContainer.TryAdd(item, 1);
                    activeDropPodInfo.openDelay = 60;
                    activeDropPodInfo.leaveSlag = false;
                    activeDropPodInfo.despawnPodBeforeSpawningThing = true;
                    activeDropPodInfo.spawnWipeMode = WipeMode.Vanish;
                    DropPodUtility.MakeDropPodAt(invalid, map, activeDropPodInfo);
                }
            }
            upgradedCrashedShipParts.Clear();
            List <Site> sites = Find.WorldObjects.Sites;
            int         l;

            for (l = 0; l < sites.Count; l++)
            {
                if (!Find.QuestManager.QuestsListForReading.Any((Quest x) => x.QuestLookTargets.Contains(sites[l])))
                {
                    Quest quest = Quest.MakeRaw();
                    QuestUtility.GenerateBackCompatibilityNameFor(quest);
                    quest.SetInitiallyAccepted();
                    quest.appearanceTick = sites[l].creationGameTicks;
                    TimeoutComp component = sites[l].GetComponent <TimeoutComp>();
                    if (component != null && component.Active && !sites[l].HasMap)
                    {
                        QuestPartUtility.MakeAndAddQuestTimeoutDelay(quest, component.TicksLeft, sites[l]);
                        component.StopTimeout();
                    }
                    QuestPartUtility.MakeAndAddEndCondition <QuestPart_NoWorldObject>(quest, quest.InitiateSignal, QuestEndOutcome.Unknown).worldObject = sites[l];
                    ChoiceLetter choiceLetter = Find.Archive.ArchivablesListForReading.OfType <ChoiceLetter>().FirstOrDefault((ChoiceLetter x) => x.lookTargets != null && x.lookTargets.targets.Contains(sites[l]));
                    if (choiceLetter != null)
                    {
                        quest.description = choiceLetter.text;
                    }
                    Find.QuestManager.Add(quest);
                }
            }
            List <WorldObject> worldObjects = Find.WorldObjects.AllWorldObjects;
            int k;

            for (k = 0; k < worldObjects.Count; k++)
            {
                if (worldObjects[k].def == WorldObjectDefOf.EscapeShip && !Find.QuestManager.QuestsListForReading.Any((Quest x) => x.PartsListForReading.Any((QuestPart y) => y is QuestPart_NoWorldObject && ((QuestPart_NoWorldObject)y).worldObject == worldObjects[k])))
                {
                    MakeAndAddWorldObjectQuest(worldObjects[k], null);
                }
            }
            int j;

            for (j = 0; j < worldObjects.Count; j++)
            {
                if (worldObjects[j] is PeaceTalks && !Find.QuestManager.QuestsListForReading.Any((Quest x) => x.PartsListForReading.Any((QuestPart y) => y is QuestPart_NoWorldObject && ((QuestPart_NoWorldObject)y).worldObject == worldObjects[j])))
                {
                    Quest        quest2        = MakeAndAddWorldObjectQuest(worldObjects[j], null);
                    ChoiceLetter choiceLetter2 = Find.Archive.ArchivablesListForReading.OfType <ChoiceLetter>().FirstOrDefault((ChoiceLetter x) => x.lookTargets != null && x.lookTargets.targets.Contains(worldObjects[j]));
                    if (choiceLetter2 != null)
                    {
                        quest2.description = choiceLetter2.text;
                    }
                }
            }
            int i;

            for (i = 0; i < worldObjects.Count; i++)
            {
                TradeRequestComp component2 = worldObjects[i].GetComponent <TradeRequestComp>();
                if (component2 != null && component2.ActiveRequest && !Find.QuestManager.QuestsListForReading.Any((Quest x) => x.PartsListForReading.Any((QuestPart y) => y is QuestPart_NoWorldObject && ((QuestPart_NoWorldObject)y).worldObject == worldObjects[i])))
                {
                    Quest        quest3        = MakeAndAddTradeRequestQuest(worldObjects[i], null, component2);
                    ChoiceLetter choiceLetter3 = Find.Archive.ArchivablesListForReading.OfType <ChoiceLetter>().FirstOrDefault((ChoiceLetter x) => x.lookTargets != null && x.lookTargets.targets.Contains(worldObjects[i]));
                    if (choiceLetter3 != null)
                    {
                        quest3.description = choiceLetter3.text;
                    }
                }
            }
        }
Esempio n. 10
0
        public void ReceiveLetter(TaggedString label, TaggedString text, LetterDef textLetterDef, LookTargets lookTargets, Faction relatedFaction = null, Quest quest = null, List <ThingDef> hyperlinkThingDefs = null, string debugInfo = null)
        {
            ChoiceLetter let = LetterMaker.MakeLetter(label, text, textLetterDef, lookTargets, relatedFaction, quest, hyperlinkThingDefs);

            ReceiveLetter(let, debugInfo);
        }
Esempio n. 11
0
        public void ReceiveLetter(string label, string text, LetterDef textLetterDef, GlobalTargetInfo lookTarget, string debugInfo = null)
        {
            ChoiceLetter let = LetterMaker.MakeLetter(label, text, textLetterDef, lookTarget);

            this.ReceiveLetter(let, debugInfo);
        }