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 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) { 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"); }