public override void Execute(int amount, string boughtBy)
        {
            ThingDef itemDef = DefDatabase <ThingDef> .GetNamed(defName);

            String dropMessage;

            if (boughtBy == "Poll")
            {
                dropMessage = $"<color=#9147ff>By popular opinion</color>, your channel has gifted you {amount} tame {defLabel}s for your colony. Enjoy!!";
            }
            else
            {
                dropMessage = $"<color=#9147ff>{boughtBy}</color> purchased {amount} tame {defLabel}s for your colony. Enjoy!!";
            }

            List <Thing> pawnList = new List <Thing>();

            for (int i = 0; i < amount; i++)
            {
                Pawn newAnimal = PawnGenerator.GeneratePawn(itemDef.race.AnyPawnKind, Faction.OfPlayer);
                if (boughtBy != "Poll")
                {
                    newAnimal.Name = new NameTriple("", boughtBy, "");
                }
                pawnList.Add(newAnimal);
            }

            DropPodManager.createDropOfThings(pawnList, defLabel, dropMessage);
        }
        public override void Execute(int amount, string boughtBy)
        {
            ThingDef itemDef = DefDatabase <ThingDef> .GetNamed(defName);

            String dropMessage;

            // I hope no viewer uses RC with the name "Poll"
            if (boughtBy == "Poll")
            {
                dropMessage = $"<color=#9147ff>By popular opinion</color>, your channel has gifted you {amount} {defLabel}s for your colony. Enjoy!!";
            }
            else
            {
                dropMessage = $"<color=#9147ff>{boughtBy}</color> purchased {amount} {defLabel}s for your colony. Enjoy!!";
            }

            if (itemDef.race != null)
            {
                List <Thing> pawnList = new List <Thing>();
                for (int i = 0; i < amount; i++)
                {
                    pawnList.Add(PawnGenerator.GeneratePawn(itemDef.race.AnyPawnKind, null));
                }
                DropPodManager.createDropOfThings(pawnList, defLabel, dropMessage);
            }
            else
            {
                Thing thing           = ThingMaker.MakeThing(itemDef, GenStuff.DefaultStuffFor(itemDef));
                bool  thingHasQuality = thing.TryGetQuality(out QualityCategory qualityCategory);
                if (itemDef.MadeFromStuff || itemDef.Minifiable || thingHasQuality)
                {
                    List <Thing> thingsToSpawn = new List <Thing>();
                    for (int i = 0; i < amount; i++)
                    {
                        ThingDef itemStuff = null;
                        if (itemDef.MadeFromStuff)
                        {
                            itemStuff = GenStuff.RandomStuffByCommonalityFor(itemDef);
                        }

                        Thing newThing = ThingMaker.MakeThing(itemDef, itemStuff);
                        TryAddQualityToThing(newThing);

                        if (itemDef.Minifiable)
                        {
                            newThing = newThing.MakeMinified();
                        }
                        thingsToSpawn.Add(newThing);
                    }
                    DropPodManager.createDropOfThings(thingsToSpawn, defLabel, dropMessage);
                }
                // If Our item doesn't have stuff, is minifiable, or doesn't have quality
                // we can spawn it the old way with the itemdef
                else
                {
                    DropPodManager.createDropFromDef(itemDef, amount, defLabel, dropMessage);
                }
            }
        }
        public override void Execute(int amount, string boughtBy)
        {
            var pawnList = PawnCreationManager.generateWorstColonists(amount);

            string labelString   = "RimConnectionFriendlyPawnLabel".Translate();
            string messageString = "RimConnectionFriendlyPawnMailBody".Translate(amount, Name, Description);

            DropPodManager.createDropOfThings(pawnList, labelString, messageString);
        }
Пример #4
0
        public override void Execute(int amount, string boughtBy)
        {
            var amountOfDrops = 100;

            for (int i = 0; i < amountOfDrops; i++)
            {
                DropPodManager.createDropFromDef(ThingDefOf.Gold, amount, Name, Description, false);
            }

            AlertManager.NormalEventNotification("Your viewers have sent a Golden Shower!");
        }
        public override void Execute(int amount, string boughtBy)
        {
            string notificationMessage;

            if (boughtBy == "Poll")
            {
                notificationMessage = $"<color=#9147ff>By popular opinion</color>, your channel has given you {amount} normal colonist(s)";
                boughtBy            = null;
            }
            else
            {
                notificationMessage = $"<color=#9147ff>{boughtBy}</color> purchased {amount} normal colonist(s)";
            }
            var pawnList = PawnCreationManager.generateDefaultColonists(amount, boughtBy);

            DropPodManager.createDropOfThings(pawnList, "Normal Colonist", notificationMessage);
        }
        public override void Execute(int amount, string boughtBy)
        {
            var amountMultiplier = 10;
            var colonists        = Find.ColonistBar.GetColonistsInOrder();

            var luciferiumBenefitHeDiffDef = DefDatabase <HediffDef> .GetNamed("LuciferiumHigh");

            var luciferiumAdditictionHeDiffDef = DefDatabase <HediffDef> .GetNamed("LuciferiumAddiction");

            colonists.ForEach(colonist =>
            {
                colonist.health.AddHediff(luciferiumBenefitHeDiffDef);
                colonist.health.AddHediff(luciferiumAdditictionHeDiffDef);
            });

            var amountToDrop = colonists.Count() * amountMultiplier;

            DropPodManager.createDropFromDef(ThingDefOf.Luciferium, amountToDrop, Name, "Your luciferium stock, this should last you for about half a year");

            AlertManager.NormalEventNotification("Your viewers decided that everyone should have a life threatening addiction, along with some supplies");
        }
        public override void Execute(int amount, string boughtBy)
        {
            var weaponThingDefs = DefDatabase <ThingDef> .AllDefs.Where(def => { return(def.equipmentType == EquipmentType.Primary); });

            var randomWeaponDefList = weaponThingDefs.ToList().TakeRandom(amount);
            var weaponThings        = randomWeaponDefList.Select(weaponDef => {
                var stuffForThing = GenStuff.RandomStuffFor(weaponDef);
                var thing         = ThingMaker.MakeThing(weaponDef, stuffForThing);
                thing.SetForbidden(true);

                var thingQualityComp = thing.TryGetComp <CompQuality>();
                if (thingQualityComp != null)
                {
                    Array qualityValues           = Enum.GetValues(typeof(QualityCategory));
                    QualityCategory randomQuality = (QualityCategory)qualityValues.GetValue(Rand.Range(0, qualityValues.Length));

                    thingQualityComp.SetQuality(randomQuality, ArtGenerationContext.Colony);
                }
                return(thing);
            });

            DropPodManager.createDropOfThings(weaponThings.ToList(), Name, Description);
        }