Ejemplo n.º 1
0
        public void SendProposal(Farmer receiver, ProposalType proposalType, Item gift = null)
        {
            Proposal proposal = new Proposal();

            proposal.sender.Value       = Game1.player;
            proposal.receiver.Value     = receiver;
            proposal.proposalType.Value = proposalType;
            proposal.gift.Value         = gift;
            proposals[Game1.player.UniqueMultiplayerID] = proposal;
        }
Ejemplo n.º 2
0
        public void Update()
        {
            requestMovieEndEvent.Poll();
            endMovieEvent.Poll();
            festivalPropRemovalEvent.Poll();
            demolishStableEvent.Poll();
            requestSpouseSleepEvent.Poll();
            requestPetWarpHomeEvent.Poll();
            grangeMutex.Update(Game1.getOnlineFarmers());
            demolishLock.Update();
            buildLock.Update(Game1.getOnlineFarmers());
            movieMutex.Update(Game1.getOnlineFarmers());
            if (grangeMutex.IsLockHeld() && Game1.activeClickableMenu == null)
            {
                grangeMutex.ReleaseLock();
            }
            foreach (ReadyCheck value in readyChecks.Values)
            {
                value.Update();
            }
            if (Game1.IsMasterGame && proposals.Count() > 0)
            {
                proposals.Filter((KeyValuePair <long, Proposal> pair) => playerIsOnline(pair.Key) && playerIsOnline(pair.Value.receiver.UID));
            }
            Proposal proposal = GetIncomingProposal();

            if (proposal != null && proposal.canceled.Value)
            {
                proposal.cancelConfirmed.Value = true;
            }
            if (Game1.dialogueUp)
            {
                return;
            }
            if (proposal != null)
            {
                if (!handleIncomingProposal(proposal))
                {
                    proposal.responseMessageKey.Value = genderedKey("Strings\\UI:Proposal_PlayerBusy", Game1.player);
                    proposal.response.Value           = ProposalResponse.Rejected;
                }
            }
            else if (Game1.activeClickableMenu == null && GetOutgoingProposal() != null)
            {
                Game1.activeClickableMenu = new PendingProposalDialog();
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public void Update()
        {
            requestLeoMove.Poll();
            requestMovieEndEvent.Poll();
            endMovieEvent.Poll();
            ringPhoneEvent.Poll();
            festivalPropRemovalEvent.Poll();
            demolishStableEvent.Poll();
            requestSpouseSleepEvent.Poll();
            requestHorseWarpEvent.Poll();
            kickOutOfMinesEvent.Poll();
            requestPetWarpHomeEvent.Poll();
            requestNutDrop.Poll();
            requestAddCharacterEvent.Poll();
            addCharacterEvent.Poll();
            addQiGemsToTeam.Poll();
            grangeMutex.Update(Game1.getOnlineFarmers());
            returnedDonationsMutex.Update(Game1.getOnlineFarmers());
            ordersBoardMutex.Update(Game1.getOnlineFarmers());
            qiChallengeBoardMutex.Update(Game1.getOnlineFarmers());
            junimoChestMutex.Update(Game1.getOnlineFarmers());
            demolishLock.Update();
            buildLock.Update(Game1.getOnlineFarmers());
            movieMutex.Update(Game1.getOnlineFarmers());
            goldenCoconutMutex.Update(Game1.getOnlineFarmers());
            if (grangeMutex.IsLockHeld() && Game1.activeClickableMenu == null)
            {
                grangeMutex.ReleaseLock();
            }
            foreach (SpecialOrder specialOrder in specialOrders)
            {
                specialOrder.Update();
            }
            foreach (ReadyCheck value in readyChecks.Values)
            {
                value.Update();
            }
            if (Game1.IsMasterGame && proposals.Count() > 0)
            {
                proposals.Filter((KeyValuePair <long, Proposal> pair) => playerIsOnline(pair.Key) && playerIsOnline(pair.Value.receiver.UID));
            }
            Proposal proposal = GetIncomingProposal();

            if (proposal != null && proposal.canceled.Value)
            {
                proposal.cancelConfirmed.Value = true;
            }
            if (Game1.dialogueUp)
            {
                return;
            }
            if (proposal != null)
            {
                if (!handleIncomingProposal(proposal))
                {
                    proposal.responseMessageKey.Value = genderedKey("Strings\\UI:Proposal_PlayerBusy", Game1.player);
                    proposal.response.Value           = ProposalResponse.Rejected;
                }
            }
            else if (Game1.activeClickableMenu == null && GetOutgoingProposal() != null)
            {
                Game1.activeClickableMenu = new PendingProposalDialog();
            }
        }