Beispiel #1
0
        public virtual void SetDuration(QuestDuration duration)
        {
            questDuration.Value = duration;
            WorldDate date = new WorldDate();

            switch (duration)
            {
            case QuestDuration.Week:
                date = new WorldDate(Game1.year, Game1.currentSeason, (Game1.dayOfMonth - 1) / 7 * 7);
                date.TotalDays++;
                date.TotalDays += 7;
                break;

            case QuestDuration.TwoWeeks:
                date = new WorldDate(Game1.year, Game1.currentSeason, (Game1.dayOfMonth - 1) / 7 * 7);
                date.TotalDays++;
                date.TotalDays += 14;
                break;

            case QuestDuration.Month:
                date = new WorldDate(Game1.year, Game1.currentSeason, 0);
                date.TotalDays++;
                date.TotalDays += 28;
                break;

            case QuestDuration.TwoDays:
                date            = new WorldDate(Game1.year, Game1.currentSeason, Game1.dayOfMonth);
                date.TotalDays += 2;
                break;

            case QuestDuration.ThreeDays:
                date            = new WorldDate(Game1.year, Game1.currentSeason, Game1.dayOfMonth);
                date.TotalDays += 3;
                break;
            }
            dueDate.Value = date.TotalDays;
        }
Beispiel #2
0
        private bool handleIncomingProposal(Proposal proposal)
        {
            if (Game1.gameMode != 3 || Game1.activeClickableMenu != null || Game1.currentMinigame != null)
            {
                return((ProposalType)proposal.proposalType == ProposalType.Baby);
            }
            if (Game1.currentLocation == null)
            {
                return(false);
            }
            if (proposal.proposalType.Value != ProposalType.Dance && Game1.CurrentEvent != null)
            {
                return(false);
            }
            string additionalVar = "";
            string responseYes   = null;
            string responseNo    = null;
            string questionKey2;

            if ((ProposalType)proposal.proposalType == ProposalType.Dance)
            {
                if (Game1.CurrentEvent == null || !Game1.CurrentEvent.isSpecificFestival("spring24"))
                {
                    return(false);
                }
                questionKey2 = "Strings\\UI:AskedToDance";
                responseYes  = "Strings\\UI:AskedToDance_Accepted";
                responseNo   = "Strings\\UI:AskedToDance_Rejected";
                if (Game1.player.dancePartner.Value != null)
                {
                    return(false);
                }
            }
            else if ((ProposalType)proposal.proposalType == ProposalType.Marriage)
            {
                if (Game1.player.isMarried() || Game1.player.isEngaged())
                {
                    proposal.response.Value           = ProposalResponse.Rejected;
                    proposal.responseMessageKey.Value = genderedKey("Strings\\UI:AskedToMarry_NotSingle", Game1.player);
                    return(true);
                }
                questionKey2 = "Strings\\UI:AskedToMarry";
                responseYes  = "Strings\\UI:AskedToMarry_Accepted";
                responseNo   = "Strings\\UI:AskedToMarry_Rejected";
            }
            else if ((ProposalType)proposal.proposalType == ProposalType.Gift && proposal.gift != null)
            {
                if (!Game1.player.couldInventoryAcceptThisItem(proposal.gift))
                {
                    proposal.response.Value           = ProposalResponse.Rejected;
                    proposal.responseMessageKey.Value = genderedKey("Strings\\UI:GiftPlayerItem_NoInventorySpace", Game1.player);
                    return(true);
                }
                questionKey2  = "Strings\\UI:GivenGift";
                additionalVar = proposal.gift.Value.DisplayName;
            }
            else
            {
                if ((ProposalType)proposal.proposalType != ProposalType.Baby)
                {
                    return(false);
                }
                if (proposal.sender.Value.IsMale != Game1.player.IsMale)
                {
                    questionKey2 = "Strings\\UI:AskedToHaveBaby";
                    responseYes  = "Strings\\UI:AskedToHaveBaby_Accepted";
                    responseNo   = "Strings\\UI:AskedToHaveBaby_Rejected";
                }
                else
                {
                    questionKey2 = "Strings\\UI:AskedToAdoptBaby";
                    responseYes  = "Strings\\UI:AskedToAdoptBaby_Accepted";
                    responseNo   = "Strings\\UI:AskedToAdoptBaby_Rejected";
                }
            }
            questionKey2 = genderedKey(questionKey2, proposal.sender);
            if (responseYes != null)
            {
                responseYes = genderedKey(responseYes, Game1.player);
            }
            if (responseNo != null)
            {
                responseNo = genderedKey(responseNo, Game1.player);
            }
            string question = Game1.content.LoadString(questionKey2, proposal.sender.Value.Name, additionalVar);

            Game1.currentLocation.createQuestionDialogue(question, Game1.currentLocation.createYesNoResponses(), delegate(Farmer _, string answer)
            {
                if (proposal.canceled.Value)
                {
                    Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\UI:ProposalWithdrawn", proposal.sender.Value.Name));
                    proposal.response.Value           = ProposalResponse.Rejected;
                    proposal.responseMessageKey.Value = responseNo;
                }
                else if (answer == "Yes")
                {
                    proposal.response.Value           = ProposalResponse.Accepted;
                    proposal.responseMessageKey.Value = responseYes;
                    if (proposal.proposalType.Value == ProposalType.Gift || proposal.proposalType.Value == ProposalType.Marriage)
                    {
                        Item value          = proposal.gift.Value;
                        proposal.gift.Value = null;
                        value = Game1.player.addItemToInventory(value);
                        if (value != null)
                        {
                            Game1.currentLocation.debris.Add(new Debris(value, Game1.player.Position));
                        }
                    }
                    if (proposal.proposalType.Value == ProposalType.Dance)
                    {
                        Game1.player.dancePartner.Value = proposal.sender.Value;
                    }
                    if (proposal.proposalType.Value == ProposalType.Marriage)
                    {
                        Friendship friendship = GetFriendship(proposal.sender.Value.UniqueMultiplayerID, Game1.player.UniqueMultiplayerID);
                        friendship.Status     = FriendshipStatus.Engaged;
                        friendship.Proposer   = proposal.sender.Value.UniqueMultiplayerID;
                        WorldDate worldDate   = new WorldDate(Game1.Date);
                        worldDate.TotalDays  += 3;
                        while (!Game1.canHaveWeddingOnDay(worldDate.DayOfMonth, worldDate.Season))
                        {
                            worldDate.TotalDays++;
                        }
                        friendship.WeddingDate = worldDate;
                        Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\UI:PlayerWeddingArranged"));
                        Game1.multiplayer.globalChatInfoMessage("Engaged", Game1.player.Name, proposal.sender.Value.Name);
                    }
                    if (proposal.proposalType.Value == ProposalType.Baby)
                    {
                        Friendship friendship2       = GetFriendship(proposal.sender.Value.UniqueMultiplayerID, Game1.player.UniqueMultiplayerID);
                        WorldDate worldDate2         = new WorldDate(Game1.Date);
                        worldDate2.TotalDays        += 14;
                        friendship2.NextBirthingDate = worldDate2;
                    }
                    Game1.player.doEmote(20);
                }
                else
                {
                    proposal.response.Value           = ProposalResponse.Rejected;
                    proposal.responseMessageKey.Value = responseNo;
                }
            });
            return(true);
        }