Exemplo n.º 1
0
        private void Events_NPCCheckAction(object sender, bwdyworks.Events.NPCCheckActionEventArgs args)
        {
            if (args.Cancelled)
            {
                return;
            }
            var name = args.NPC.Name;

            if (name.StartsWith("Moongate"))
            {
                args.Cancelled = true;
            }
        }
Exemplo n.º 2
0
        private void Events_NPCCheckAction(object sender, bwdyworks.Events.NPCCheckActionEventArgs args)
        {
            if (args.Cancelled)
            {
                return; //someone else already ate this one
            }
            //do we care about this NPC for our purposes?
            var targetedNPCs = Modworks.NPCs.GetAllCharacterNames(true, false, args.Farmer.currentLocation);

            if (!targetedNPCs.Contains(args.NPC.Name))
            {
                return;
            }

            //let's run the tests
            Modworks.Log.Trace("Polygamy, beginning interaction with dateable NPC");
            NPC n2 = args.NPC;

            //are we holding an item
            if (Game1.player.ActiveObject != null)
            {
                //is it the bouquet?
                if (Game1.player.ActiveObject.ParentSheetIndex == 458)
                {
                    Modworks.Log.Trace("Polygamy, we are beginning a bouquet check");
                    if (!Relationships.DateableNPCs.Contains(n2))
                    {
                        Modworks.Log.Trace("Polygamy, refusing date because not dateable (or not available)");
                        //REFUSE, NOT DATEABLE
                        //either divorced, already married, already dating, or not available
                        args.Cancelled = true;
                        n2.CurrentDialogue.Push(new Dialogue((n2.Gender == 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3970") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3971"), n2));
                        Game1.drawDialogue(n2);
                        return;
                    }
                    else
                    {
                        if (Modworks.Player.GetFriendshipPoints(n2.Name) >= 2000) //ready for relationship!
                        {
                            Modworks.Log.Trace("Polygamy, happy to date!");
                            //LETTUCE DATE
                            args.Cancelled = true;
                            n2.faceTowardFarmerForPeriod(5000, 60, false, Game1.player);
                            Relationships.Date(n2.Name);
                            n2.CurrentDialogue.Push(new Dialogue((Game1.random.NextDouble() < 0.5) ? Game1.LoadStringByGender(n2.Gender, "Strings\\StringsFromCSFiles:NPC.cs.3962") : Game1.LoadStringByGender(n2.Gender, "Strings\\StringsFromCSFiles:NPC.cs.3963"), n2));
                            Game1.player.reduceActiveItemByOne();
                            Game1.player.completelyStopAnimatingOrDoingAction();
                            n2.doEmote(20);
                            Game1.drawDialogue(n2);
                            Relationships.ScanForNPCs();
                            return;
                        }
                        else
                        {
                            Modworks.Log.Trace("Polygamy, refusing date because friendship is too low");
                            //REFUSE, DONT KNOW YOU WELL ENOUGH
                            args.Cancelled = true;
                            n2.CurrentDialogue.Push(new Dialogue((Game1.random.NextDouble() < 0.5) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3958") : Game1.LoadStringByGender(n2.Gender, "Strings\\StringsFromCSFiles:NPC.cs.3959"), n2));
                            Game1.drawDialogue(n2);
                            return;
                        }
                    }
                }
                //or is the pendant?
                else if (Game1.player.ActiveObject.ParentSheetIndex == 460)
                {
                    Modworks.Log.Trace("Polygamy, we are beginning a pendant check");
                    if (Game1.player.HouseUpgradeLevel < 1)
                    {
                        Modworks.Log.Trace("Polygamy, rejecting proposal because house is too small");
                        //REFUSE, NOWHERE TO LIVE
                        args.Cancelled = true;
                        if (Game1.random.NextDouble() < 0.1)
                        {
                            n2.CurrentDialogue.Push(new Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3972"), n2));
                        }
                        else
                        {
                            n2.CurrentDialogue.Push(new Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:Pickaxe.cs.14194") + "$h", n2));
                        }
                        Game1.drawDialogue(n2);
                        return;
                    }
                    else
                    {
                        if (!Relationships.MarryableNPCs.Contains(n2))
                        {
                            Modworks.Log.Trace("Polygamy, rejecting proposal because NPC is not dateable (or not available)");
                            //REFUSE, NOT MARRYABLE
                            //either divorced, already married, not dating, or not available
                            args.Cancelled = true;
                            n2.CurrentDialogue.Push(new Dialogue((n2.Gender == 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3970") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3971"), n2));
                            Game1.drawDialogue(n2);
                            return;
                        }
                        else
                        {
                            if (Modworks.Player.GetFriendshipPoints(n2.Name) >= 2499) //ready for marriage!
                            {
                                Modworks.Log.Trace("Polygamy, so happy to get engaged!");
                                //LETTUCE MARRY
                                args.Cancelled = true;
                                Game1.changeMusicTrack("none");
                                n2.CurrentDialogue.Clear();
                                Relationships.Engage(n2.Name);
                                Modworks.Player.SetFriendshipPoints(n2.Name, 2500);
                                Dialogue d1, d2, d3;
                                bool     dialogueOk = Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue").ContainsKey(n2.Name + "0");
                                if (!dialogueOk)
                                {
                                    //we're marrying something that doesn't have accept dialogue. default dialog
                                    if (n2.Gender == 0)
                                    { //male
                                        d1 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Sebastian" + "0"], n2);
                                        d2 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Alex" + "1"], n2);
                                    }
                                    else
                                    { //female
                                        d1 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Alex" + "0"], n2);
                                        d2 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Leah" + "0"], n2);
                                    }
                                }
                                else
                                {
                                    d1 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")[n2.Name + "0"], n2);
                                    d2 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")[n2.Name + "1"], n2);
                                }
                                d3 = new Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3980"), n2);
                                n2.CurrentDialogue.Push(d1);
                                n2.CurrentDialogue.Push(d2);
                                n2.CurrentDialogue.Push(d3);
                                Game1.player.reduceActiveItemByOne();
                                Game1.player.completelyStopAnimatingOrDoingAction();
                                Game1.drawDialogue(n2);
                                Relationships.ScanForNPCs();
                                return;
                            }
                            else
                            {
                                Modworks.Log.Trace("Polygamy, rejecting proposal because friendship is too low");
                                //REFUSE, DONT KNOW YOU WELL ENOUGH
                                args.Cancelled = true;
                                n2.CurrentDialogue.Push(new Dialogue((Game1.random.NextDouble() < 0.5) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3972") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3973"), n2));
                                Game1.drawDialogue(n2);
                                return;
                            }
                        }
                    }
                }
            }
            // not holding an item
            else
            {
                // NOW KISS (Kissing available after dating)
                var kissFriendshipStatuses = new List <FriendshipStatus>()
                {
                    FriendshipStatus.Married, FriendshipStatus.Engaged, FriendshipStatus.Dating
                };
                if (kissFriendshipStatuses.Contains(Modworks.Player.GetFriendshipStatus(n2.Name)))
                {
                    Modworks.Log.Trace("Polygamy, go in for a kiss!");

                    if (!Relationships.TryKiss(n2.Name, 8))
                    {
                        Modworks.Log.Trace("Polygamy, Kiss failed.");
                        return;
                    }

                    // KISS AND THEN TELL ME YOU LOVE ME (1/8 chance). Too high? Too low?
                    var x = Modworks.RNG.Next(0, 200);
                    if (x < 25)
                    {
                        Modworks.Log.Trace("Polygamy, You lucky kisser.");
                        var kissDialoguesAndEmotions = new Dictionary <string, string>()
                        {
                            { "I love you babe.", Dialogue.dialogueHappy },
                            { "Oh stop it!", Dialogue.dialogueHappy },
                            { "Kiss me again...", Dialogue.dialogueLove },
                            { "You're the best.", Dialogue.dialogueHappy },
                            { "Your lips are so soft...", Dialogue.dialogueLove },
                            { "So, later you want to...?", Dialogue.dialogueLove },
                            { "Ok, seriously...?", Dialogue.dialogueAngry } // Sorry if you get this one first :P You're unlucky! TODO: Make it so bad ones can only come 2nd-n (n > 2)
                        };

                        var kissDialogueAndEmotion = kissDialoguesAndEmotions.ElementAt(Modworks.RNG.Next(kissDialoguesAndEmotions.Count - 1));
                        var dialogue = new Dialogue(kissDialogueAndEmotion.Key, n2);
                        dialogue.CurrentEmotion = kissDialogueAndEmotion.Value;

                        n2.CurrentDialogue.Push(dialogue);

                        Game1.drawDialogue(n2);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void Events_NPCCheckAction(object sender, bwdyworks.Events.NPCCheckActionEventArgs args)
        {
            if (args.Cancelled)
            {
                return;                 //someone else already ate this one
            }
            //do we care about this NPC for our purposes?
            var targetedNPCs = Modworks.NPCs.GetAllCharacterNames(true, false, args.Farmer.currentLocation);

            if (!targetedNPCs.Contains(args.NPC.Name))
            {
                return;
            }

            //let's run the tests
            Modworks.Log.Trace("Polygamy, beginning interaction with dateable NPC");
            NPC n2 = args.NPC;

            //are we holding an item
            if (Game1.player.ActiveObject != null)
            {
                //is it the bouquet?
                if (Game1.player.ActiveObject.ParentSheetIndex == 458)
                {
                    Modworks.Log.Trace("Polygamy, we are beginning a bouquet check");
                    if (!Relationships.DateableNPCs.Contains(n2))
                    {
                        Modworks.Log.Trace("Polygamy, refusing date because not dateable (or not available)");
                        //REFUSE, NOT DATEABLE
                        //either divorced, already married, already dating, or not available
                        args.Cancelled = true;
                        n2.CurrentDialogue.Push(new Dialogue((n2.Gender == 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3970") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3971"), n2));
                        Game1.drawDialogue(n2);
                        return;
                    }
                    else
                    {
                        if (Modworks.Player.GetFriendshipPoints(n2.Name) >= 2000) //ready for relationship!
                        {
                            Modworks.Log.Trace("Polygamy, happy to date!");
                            //LETTUCE DATE
                            args.Cancelled = true;
                            n2.faceTowardFarmerForPeriod(5000, 60, false, Game1.player);
                            Relationships.Date(n2.Name);
                            n2.CurrentDialogue.Push(new Dialogue((Game1.random.NextDouble() < 0.5) ? Game1.LoadStringByGender(n2.Gender, "Strings\\StringsFromCSFiles:NPC.cs.3962") : Game1.LoadStringByGender(n2.Gender, "Strings\\StringsFromCSFiles:NPC.cs.3963"), n2));
                            Game1.player.reduceActiveItemByOne();
                            Game1.player.completelyStopAnimatingOrDoingAction();
                            n2.doEmote(20);
                            Game1.drawDialogue(n2);
                            Relationships.ScanForNPCs();
                            return;
                        }
                        else
                        {
                            Modworks.Log.Trace("Polygamy, refusing date because friendship is too low");
                            //REFUSE, DONT KNOW YOU WELL ENOUGH
                            args.Cancelled = true;
                            n2.CurrentDialogue.Push(new Dialogue((Game1.random.NextDouble() < 0.5) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3958") : Game1.LoadStringByGender(n2.Gender, "Strings\\StringsFromCSFiles:NPC.cs.3959"), n2));
                            Game1.drawDialogue(n2);
                            return;
                        }
                    }
                }
                //or is the pendant?
                else if (Game1.player.ActiveObject.ParentSheetIndex == 460)
                {
                    Modworks.Log.Trace("Polygamy, we are beginning a pendant check");
                    if (Game1.player.HouseUpgradeLevel < 1)
                    {
                        Modworks.Log.Trace("Polygamy, rejecting proposal because house is too small");
                        //REFUSE, NOWHERE TO LIVE
                        args.Cancelled = true;
                        if (Game1.random.NextDouble() < 0.1)
                        {
                            n2.CurrentDialogue.Push(new Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3972"), n2));
                        }
                        else
                        {
                            n2.CurrentDialogue.Push(new Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:Pickaxe.cs.14194") + "$h", n2));
                        }
                        Game1.drawDialogue(n2);
                        return;
                    }
                    else
                    {
                        if (!Relationships.MarryableNPCs.Contains(n2))
                        {
                            Modworks.Log.Trace("Polygamy, rejecting proposal because NPC is not dateable (or not available)");
                            //REFUSE, NOT MARRYABLE
                            //either divorced, already married, not dating, or not available
                            args.Cancelled = true;
                            n2.CurrentDialogue.Push(new Dialogue((n2.Gender == 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3970") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3971"), n2));
                            Game1.drawDialogue(n2);
                            return;
                        }
                        else
                        {
                            if (Modworks.Player.GetFriendshipPoints(n2.Name) >= 2499) //ready for marriage!
                            {
                                Modworks.Log.Trace("Polygamy, so happy to get engaged!");
                                //LETTUCE MARRY
                                args.Cancelled = true;
                                Game1.changeMusicTrack("none");
                                n2.CurrentDialogue.Clear();
                                Relationships.Engage(n2.Name);
                                Modworks.Player.SetFriendshipPoints(n2.Name, 2500);
                                Dialogue d1, d2, d3;
                                bool     dialogueOk = Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue").ContainsKey(n2.Name + "0");
                                if (!dialogueOk)
                                {
                                    //we're marrying something that doesn't have accept dialogue. default dialog
                                    if (n2.Gender == 0)
                                    { //male
                                        d1 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Sebastian" + "0"], n2);
                                        d2 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Alex" + "1"], n2);
                                    }
                                    else
                                    { //female
                                        d1 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Alex" + "0"], n2);
                                        d2 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")["Leah" + "0"], n2);
                                    }
                                }
                                else
                                {
                                    d1 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")[n2.Name + "0"], n2);
                                    d2 = new Dialogue(Game1.content.Load <Dictionary <string, string> >("Data\\EngagementDialogue")[n2.Name + "1"], n2);
                                }
                                d3 = new Dialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3980"), n2);
                                n2.CurrentDialogue.Push(d1);
                                n2.CurrentDialogue.Push(d2);
                                n2.CurrentDialogue.Push(d3);
                                Game1.player.reduceActiveItemByOne();
                                Game1.player.completelyStopAnimatingOrDoingAction();
                                Game1.drawDialogue(n2);
                                Relationships.ScanForNPCs();
                                return;
                            }
                            else
                            {
                                Modworks.Log.Trace("Polygamy, rejecting proposal because friendship is too low");
                                //REFUSE, DONT KNOW YOU WELL ENOUGH
                                args.Cancelled = true;
                                n2.CurrentDialogue.Push(new Dialogue((Game1.random.NextDouble() < 0.5) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3972") : Game1.content.LoadString("Strings\\StringsFromCSFiles:NPC.cs.3973"), n2));
                                Game1.drawDialogue(n2);
                                return;
                            }
                        }
                    }
                }
            }
        }