Пример #1
0
 public override void TryExecute()
 {
     if (worker.TryExecute(parms))
     {
         Viewer.TakeViewerCoins(pointsWager);
         Viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
         VariablesHelpers.SendPurchaseMessage($"Starting {worker.def.LabelCap} with {pointsWager} points wagered and {(int)parms.points} disease points purchased by {Viewer.username}");
         return;
     }
     TwitchWrapper.SendChatMessage($"@{Viewer.username} not enough points spent for diseases.");
 }
 public override void TryExecute()
 {
     if (worker.TryExecute(parms))
     {
         Viewer.TakeViewerCoins(pointsWager);
         Viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
         VariablesHelpers.SendPurchaseMessage($"Spawning animal {pawnKind.LabelCap} with {pointsWager} coins wagered and {(int)parms.points} animal points purchased by {Viewer.username}", separateChannel);
         return;
     }
     Toolkit.client.SendMessage($"@{Viewer.username} not enough points spent for diseases.", separateChannel);
 }
 public override void TryExecute()
 {
     if (worker.TryExecute(parms))
     {
         Viewer.TakeViewerCoins(pointsWager);
         Viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
         VariablesHelpers.SendPurchaseMessage($"Starting predator pack with {pointsWager} points wagered and {(int)parms.points} raid points purchased by {Viewer.username}", separateChannel);
         return;
     }
     Toolkit.client.SendMessage($"@{Viewer.username} could not generate parms for manhunter pack.", separateChannel);
 }
Пример #4
0
 public override void TryExecute()
 {
     if (worker.TryExecute(parms))
     {
         viewer.TakeViewerCoins(pointsWager);
         viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
         VariablesHelpers.SendPurchaseMessage($"Starting raid with {pointsWager} points wagered and {(int)parms.points} raid points purchased by {viewer.username}", separateChannel);
         return;
     }
     Toolkit.client.SendMessage($"@{viewer.username} not enough points spent for raid.", separateChannel);
 }
 public override void TryExecute()
 {
     Log.Warning("trying execution");
     if (worker.TryExecute(parms))
     {
         viewer.TakeViewerCoins(pointsWager);
         viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
         VariablesHelpers.SendPurchaseMessage($"Starting infestation raid with {pointsWager} points wagered and {(int)parms.points} raid points purchased by {viewer.username}", separateChannel);
         return;
     }
     Toolkit.client.SendMessage($"@{viewer.username} could not generate parms for infestation.", separateChannel);
 }
Пример #6
0
        public override void TryExecute()
        {
            System.Random rand  = new System.Random();
            float         xpWon = pawn.skills.GetSkill(skill).XpRequiredForLevelUp *((float)rand.Next(50, 150) / 100f);

            pawn.skills.Learn(skill, xpWon, true);
            viewer.TakeViewerCoins(pointsWager);
            viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
            VariablesHelpers.SendPurchaseMessage($"Increasing skill for {pawn.LabelCap} with {pointsWager} coins wagered and {(int)xpWon} xp for {skill.defName} purchased by {viewer.username}", separateChannel);
            string text = Helper.ReplacePlaceholder("TwitchStoriesDescription55".Translate(), colonist: pawn.Name.ToString(), skill: skill.defName, first: Math.Round(xpWon).ToString());

            Current.Game.letterStack.ReceiveLetter("TwitchToolkitIncreaseSkill".Translate(), text, LetterDefOf.PositiveEvent, pawn);
        }
Пример #7
0
        public override void TryExecute()
        {
            ThingDef itemDef   = ThingDef.Named("DropPodIncoming");
            Thing    itemThing = new Thing();

            ThingDef stuff        = null;
            ThingDef itemThingDef = ThingDef.Named(item.defname);

            if (itemThingDef.MadeFromStuff)
            {
                if (!(from x in GenStuff.AllowedStuffsFor(itemThingDef, TechLevel.Undefined)
                      where !PawnWeaponGenerator.IsDerpWeapon(itemThingDef, x)
                      select x).TryRandomElementByWeight((ThingDef x) => x.stuffProps.commonality, out stuff))
                {
                    stuff = GenStuff.RandomStuffByCommonalityFor(itemThingDef, TechLevel.Undefined);
                }
            }

            itemThing = ThingMaker.MakeThing(itemThingDef, (stuff != null) ? stuff : null);

            QualityCategory q = new QualityCategory();

            if (itemThing.TryGetQuality(out q))
            {
                ItemHelper.setItemQualityRandom(itemThing);
            }

            IntVec3 vec;

            if (itemThingDef.Minifiable)
            {
                itemThingDef = itemThingDef.minifiedDef;
                MinifiedThing minifiedThing = (MinifiedThing)ThingMaker.MakeThing(itemThingDef, null);
                minifiedThing.InnerThing = itemThing;
                minifiedThing.stackCount = quantity;
                vec = Helper.Rain(itemDef, minifiedThing);
            }
            else
            {
                itemThing.stackCount = quantity;
                vec = Helper.Rain(itemDef, itemThing);
            }

            string letter = Helper.ReplacePlaceholder("TwitchStoriesDescription80".Translate(), from: viewer.username, amount: quantity.ToString(), item: item.abr.CapitalizeFirst());

            Helper.CarePackage(letter, LetterDefOf.PositiveEvent, vec);

            viewer.TakeViewerCoins(price);
            viewer.CalculateNewKarma(storeIncident.karmaType, price);
            VariablesHelpers.SendPurchaseMessage(Helper.ReplacePlaceholder("TwitchToolkitItemPurchaseConfirm".Translate(), amount: quantity.ToString(), item: item.abr, viewer: viewer.username), separateChannel);
        }
        public override void TryExecute()
        {
            bool success = worker.TryExecute(parms);

            ToolkitPatchLogger.Log(incidentDef.defName, $"Executed. Result: {success}");
            if (success)
            {
                Viewer.TakeViewerCoins(pointsWager);
                Viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
                VariablesHelpers.SendPurchaseMessage($"Starting {storeIncident.label} with {pointsWager} points wagered and {(int)parms.points} points purchased by {Viewer.username}", separateChannel);
                return;
            }
            Toolkit.client.SendMessage($"@{Viewer.username} could not generate parms for {storeIncident.label}.", separateChannel);
        }
        public override void TryExecute()
        {
            if (worker.TryExecute(parms))
            {
                Viewer.TakeViewerCoins(pointsWager);
                Viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
                VariablesHelpers.SendPurchaseMessage(
                    $"Starting drop raid with {pointsWager} points wagered and {(int)parms.points} raid points purchased by {Viewer.username}",
                    separateChannel);
                return;
            }

            TwitchWrapper.SendChatMessage($"@{Viewer.username} could not generate parms for drop raid.");
        }
        public override void TryExecute()
        {
            float customMultiplier = CustomSettings.LookupFloatSetting("Toolkit.LevelPawn.XPMultiplier") > 0 ? CustomSettings.LookupFloatSetting("Toolkit.LevelPawn.XPMultiplier") : 0.5f;
            float xpWon            = pawn.skills.GetSkill(skill).XpRequiredForLevelUp *customMultiplier *((float)Verse.Rand.Range(0.5f, 1.5f));

            xpWon = IncidentHelper_PointsHelper.RollProportionalGamePoints(storeIncident, pointsWager, xpWon);
            pawn.skills.Learn(skill, xpWon, true);
            viewer.TakeViewerCoins(pointsWager);
            viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
            VariablesHelpers.SendPurchaseMessage($"Increasing skill for {pawn.LabelCap} with {pointsWager} coins wagered and {(int)xpWon} xp for {skill.defName} purchased by {viewer.username}", separateChannel);
            string text = Helper.ReplacePlaceholder("TwitchStoriesDescription55".Translate(), colonist: pawn.Name.ToString(), skill: skill.defName, first: Math.Round(xpWon).ToString());

            Current.Game.letterStack.ReceiveLetter("TwitchToolkitIncreaseSkill".Translate(), text, LetterDefOf.PositiveEvent, pawn);
        }
        public override void TryExecute()
        {
            // take actions for incident
            List <Pawn> pawns = Helper.AnyPlayerMap.mapPawns.FreeColonistsSpawned.ToList();

            pawns.Shuffle();

            bool           successfulInspiration = false;
            InspirationDef randomAvailableInspirationDef;

            foreach (Pawn pawn in pawns)
            {
                if (pawn.Inspired)
                {
                    continue;
                }

                randomAvailableInspirationDef = (
                    from x in DefDatabase <InspirationDef> .AllDefsListForReading
                    where true
                    select x).RandomElementByWeightWithFallback((InspirationDef x) => x.Worker.CommonalityFor(pawn), null
                                                                );

                if (randomAvailableInspirationDef != null)
                {
                    successfulInspiration = pawn.mindState.inspirationHandler.TryStartInspiration(randomAvailableInspirationDef);
                    if (successfulInspiration)
                    {
                        break;
                    }
                }
            }

            if (successfulInspiration)
            {
                Viewer.TakeViewerCoins(storeIncident.cost);

                // calculate new karma if needed
                Viewer.CalculateNewKarma(storeIncident.karmaType, storeIncident.cost);

                // send a purchase confirmation message
                VariablesHelpers.SendPurchaseMessage($"@{Viewer.username} purchased a random inspiration.");
            }
            else
            {
                VariablesHelpers.SendPurchaseMessage($"@{Viewer.username} attempted to inspired a pawn, but none were successful.");
            }
        }
        public override void TryExecute()
        {
            if (worker.TryExecute(parms))
            {
                viewer.TakeViewerCoins(pointsWager);
                viewer.CalculateNewKarma(this.storeIncident.karmaType, pointsWager);
                VariablesHelpers.SendPurchaseMessage(
                    Helper.ReplacePlaceholder("TranslationKey".Translate(),
                                              amount: pointsWager.ToString(),
                                              first: Convert.ToInt32(parms.points).ToString(),
                                              viewer: viewer.username),
                    separateChannel);
                return;
            }

            Toolkit.client.SendMessage($"@{viewer.username} not enough points spent for drop raid.", separateChannel);
        }
Пример #13
0
        public override void TryExecute()
        {
            Map map = Helper.AnyPlayerMap;
            StorytellerComp_HodlBot storytellerComp = new StorytellerComp_HodlBot();

            storytellerComp.forced = true;
            foreach (FiringIncident incident in storytellerComp.MakeIntervalIncidents(map))
            {
                Ticker.FiringIncidents.Enqueue(incident);
                break;
            }

            Viewer.TakeViewerCoins(storeIncident.cost);

            Viewer.CalculateNewKarma(storeIncident.karmaType, storeIncident.cost);

            VariablesHelpers.SendPurchaseMessage($"@{Viewer.username} purchased a HodlBot Vote.");
        }
Пример #14
0
        public override void TryExecute()
        {
            PawnKindDef           pawnKind = PawnKindDefOf.Colonist;
            Faction               ofPlayer = Faction.OfPlayer;
            bool                  pawnMustBeCapableOfViolence = true;
            PawnGenerationRequest request = new PawnGenerationRequest(pawnKind, ofPlayer, PawnGenerationContext.NonPlayer, -1, true, false, false, false, true, pawnMustBeCapableOfViolence, 20f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null);
            Pawn                  pawn    = PawnGenerator.GeneratePawn(request);
            NameTriple            old     = pawn.Name as NameTriple;

            pawn.Name = new NameTriple(old.First, viewer.username, old.Last);
            GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish);
            string label = "Viewer Joins";
            string text  = $"A new pawn has been purchased by {viewer.username}, let's welcome them to the colony.";

            PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn);
            Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.PositiveEvent, pawn, null, null);

            Current.Game.GetComponent <GameComponentPawns>().AssignUserToPawn(viewer.username, pawn);
            viewer.TakeViewerCoins(this.storeIncident.cost);
            viewer.CalculateNewKarma(this.storeIncident.karmaType, storeIncident.cost);

            VariablesHelpers.SendPurchaseMessage($"@{viewer.username} has purchased a pawn and is joining the colony.", separateChannel);
        }
 private void EndCarePackage()
 {
     Viewer.TakeViewerCoins(price);
     Viewer.CalculateNewKarma(storeIncident.karmaType, price);
     VariablesHelpers.SendPurchaseMessage(Helper.ReplacePlaceholder("TwitchToolkitItemPurchaseConfirm".Translate(), amount: quantity.ToString(), item: item.abr, viewer: Viewer.username));
 }