예제 #1
0
        private static void FeedAnimalTreat(long id, Object treat)
        {
            AnimalStatus animalStatus = GetAnimalStatus(id);

            animalStatus.LastDayFeedTreat = SDate.Now();
            if (!animalStatus.FeedTreatsQuantity.ContainsKey(treat.ParentSheetIndex))
            {
                animalStatus.FeedTreatsQuantity[treat.ParentSheetIndex] = 0;
            }
            animalStatus.FeedTreatsQuantity[treat.ParentSheetIndex]++;
        }
예제 #2
0
        protected static AnimalStatus GetAnimalStatus(long id)
        {
            AnimalStatus animalStatus = FarmerLoader.FarmerData.AnimalData.Find(s => s.Id == id);

            if (animalStatus == null)
            {
                animalStatus = new AnimalStatus(id);
                FarmerLoader.FarmerData.AnimalData.Add(animalStatus);
            }

            return(animalStatus);
        }
 public static void EndEvent(AnimalContestItem animalContestItem, bool participated = true)
 {
     if (Context.IsMainPlayer)
     {
         if (!participated)
         {
             animalContestItem.Winner        = "Marnie";
             animalContestItem.Contenders    = new List <string>(new[] { "Marnie" });
             animalContestItem.VincentAnimal = null;
             animalContestItem.MarnieAnimal  = null;
         }
         if (animalContestItem.ParticipantId.HasValue)
         {
             long         participantIdValue = animalContestItem.ParticipantId.Value;
             AnimalStatus animalStatus       = GetAnimalStatus(participantIdValue);
             animalStatus.HasWon = (animalStatus.HasWon ?? false) || animalContestItem.Winner == "Farmer";
             if (participantIdValue != AnimalData.PetId)
             {
                 if (_temporaryFarmAnimal != null)
                 {
                     if (participated)
                     {
                         _temporaryFarmAnimal.friendshipTowardFarmer.Value = Math.Min(1000, _temporaryFarmAnimal.friendshipTowardFarmer.Value + DataLoader.AnimalContestData.FarmAnimalFriendshipForParticipating);
                         _temporaryFarmAnimal.happiness.Value = 255;
                     }
                     else
                     {
                         _temporaryFarmAnimal.friendshipTowardFarmer.Value = Math.Max(0, _temporaryFarmAnimal.friendshipTowardFarmer.Value - DataLoader.AnimalContestData.FarmAnimalFriendshipForParticipating);
                         _temporaryFarmAnimal.happiness.Value = 0;
                     }
                     ReAddFarmAnimal(participantIdValue);
                 }
             }
             else
             {
                 if (participated)
                 {
                     Pet pet = Game1.player.getPet();
                     pet.friendshipTowardFarmer.Value = Math.Min(Pet.maxFriendship, pet.friendshipTowardFarmer.Value + DataLoader.AnimalContestData.PetFriendshipForParticipating);
                 }
                 AnimalContestController.ReAddPet();
             }
         }
     }
 }
예제 #4
0
        private static int ProduceQuality(Random random, FarmAnimal farmAnimal)
        {
            AnimalStatus animalStatus = GetAnimalStatus(farmAnimal.myID.Value);

            if (animalStatus.HasWon ?? false)
            {
                return(4);
            }

            double chance = (double)farmAnimal.friendshipTowardFarmer.Value / 1000.0 - (1.0 - (double)farmAnimal.happiness.Value / 225.0);

            if (!farmAnimal.isCoopDweller() && Game1.getFarmer(farmAnimal.ownerID.Value).professions.Contains(3) ||
                farmAnimal.isCoopDweller() && Game1.getFarmer(farmAnimal.ownerID.Value).professions.Contains(2))
            {
                chance += 0.33;
            }
            var produceQuality = chance < 0.95 || random.NextDouble() >= chance / 2.0
                ? (random.NextDouble() >= chance / 2.0 ? (random.NextDouble() >= chance ? 0 : 1) : 2)
                : 4;

            return(produceQuality);
        }
예제 #5
0
        private static AnimalContestItem PickTheWinner(AnimalContestItem animalContestInfo, List <AnimalContestItem> history, AnimalStatus participantAnimalStatus, FarmAnimal farmAnimal, string thirdContender)
        {
            if (farmAnimal != null)
            {
                int friendshipPoints   = farmAnimal.friendshipTowardFarmer.Value / 195;
                int monthsOld          = (farmAnimal.age.Value + 1) / 28 + 1;
                int agePoints          = monthsOld < 4 ? monthsOld : Math.Max(0, 5 - (monthsOld + 1) / 2);
                int treatVariatyPoints = Math.Min(3, participantAnimalStatus.FeedTreatsQuantity.Keys.Count);
                int weeksOld           = (farmAnimal.age.Value + 1) / 7 + 1;
                int treatAveragePoints = Math.Min(3, (participantAnimalStatus.FeedTreatsQuantity.Values.Sum() * 3) / weeksOld);
                int parentWinnerPoints = history.Exists(h => h.Winner == "Farmer" && h.ParticipantId == farmAnimal.parentId.Value) ? 1 : 0;

                animalContestInfo.FarmAnimalScore = new AnimalContestScore(friendshipPoints, monthsOld, agePoints, treatVariatyPoints, treatAveragePoints, parentWinnerPoints);
                int totalPoints = animalContestInfo.FarmAnimalScore.TotalPoints;
                if (
                    (totalPoints >= DataLoader.AnimalContestData.MinPointsToGaranteeWin) ||
                    (totalPoints >= DataLoader.AnimalContestData.MinPointsToPossibleWin &&
                     agePoints > 0 && treatVariatyPoints > 0 && treatAveragePoints > 0 && friendshipPoints > 0 &&
                     history.Count(h => h.Winner != "Farmer") >= history.Count(h => h.Winner == "Farmer"))
                    )
                {
                    animalContestInfo.Winner = "Farmer";
                    return(animalContestInfo);
                }
            }
            if (history.Exists(h => h.Contenders.Contains(thirdContender)) && history.Count(h => h.Winner == "Marnie") > history.Count(h => h.Winner == thirdContender))
            {
                animalContestInfo.Winner = thirdContender;
            }
            else
            {
                animalContestInfo.Winner = "Marnie";
            }
            return(animalContestInfo);
        }
예제 #6
0
        public static CustomEvent CreateEvent(SDate contestDate)
        {
            int    eventId = GetEventId(contestDate);
            string key     = GenerateKey(eventId, contestDate);

            Random random = new Random((int)((long)Game1.uniqueIDForThisGame * 100000 + contestDate.Year * 1000 + Utility.getSeasonNumber(contestDate.Season) * 100 + contestDate.Day));

            //Player and Participant init
            long?        contestParticipantId    = AnimalContestController.ContestParticipantId(contestDate);
            AnimalStatus participantAnimalStatus = contestParticipantId != null?AnimalStatusController.GetAnimalStatus((long)contestParticipantId) : null;

            bool       isPlayerJustWatching = participantAnimalStatus == null;
            bool       isParticipantPet     = !isPlayerJustWatching && participantAnimalStatus.Id == AnimalData.PetId;
            FarmAnimal farmAnimal           = null;

            if (isParticipantPet)
            {
                AnimalContestController.TemporalyRemovePet();
            }
            else if (!isPlayerJustWatching)
            {
                farmAnimal = AnimalContestController.GetAnimal(participantAnimalStatus.Id);
                if (farmAnimal == null)
                {
                    isPlayerJustWatching = true;
                }
                else
                {
                    AnimalContestController.TemporalyRemoveFarmAnimal(farmAnimal);
                }
            }

            List <AnimalContestItem> history = FarmerLoader.FarmerData.AnimalContestData;

            string[] contenders = new string[3];
            contenders[0] = "Marnie";
            contenders[1] = GetContenderFromPool(new List <IAnimalContestAct>(PossibleSecondContenders).Where(c => !isPlayerJustWatching || !c.NpcName.Equals("Jas")).ToList(), history) ?? "Maru";
            contenders[2] = GetContenderFromPool(new List <IAnimalContestAct>(PossibleThirdContenders), history) ?? "Jodi";

            string        marnieAnimal  = MarnieAct.ChooseMarnieAnimal(random, history);
            VincentAnimal vincentAnimal = VincentAct.ChooseVincentAnimal(random, history);

            AnimalContestItem animalContestInfo = new AnimalContestItem(eventId, contestDate, contenders.ToList(), vincentAnimal.ToString(), marnieAnimal)
            {
                ParticipantId = isParticipantPet ? AnimalData.PetId : farmAnimal?.myID.Value,
                PlayerAnimal  = isParticipantPet ? Game1.player.catPerson ? "Cat" : "Dog" : farmAnimal?.type.Value
            };

            animalContestInfo = PickTheWinner(animalContestInfo, history, participantAnimalStatus, farmAnimal, contenders[2]);

            // Deciding who will be present
            bool isHaleyWatching     = Game1.player.eventsSeen.Contains(14) || Game1.player.spouse == "Haley";
            bool isKentWatching      = Game1.year > 1 && contenders.Contains("Jodi");
            bool isSebastianWatching = Game1.player.spouse != "Sebastian" && (vincentAnimal == VincentAnimal.Frog || contenders.Contains("Abigail"));
            bool isPennyWatching     = Game1.player.spouse != "Penny" && !isSebastianWatching && (contenders.Contains("Maru") || contenders.Contains("Jas") || isPlayerJustWatching || Game1.player.getFriendshipHeartLevelForNPC("Penny") >= 4);
            bool isDemetriusWatching = contenders.Contains("Maru");
            bool isClintWatching     = contenders.Contains("Emily");
            bool isLeahWatching      = Game1.player.spouse != "Leah" && Game1.player.eventsSeen.Contains(53);
            bool isLinusWatching     = !contenders.Contains("Linus") && (Game1.player.eventsSeen.Contains(26) || vincentAnimal == VincentAnimal.Rabbit);
            bool isShaneWatching     = !contenders.Contains("Shane") && (contenders.Contains("Jas") || isPlayerJustWatching || Game1.player.eventsSeen.Contains(3900074) || Game1.player.spouse == "Shane");

            StringBuilder initialPosition = new StringBuilder();

            initialPosition.Append("none/-100 -100");
            if (!isPlayerJustWatching)
            {
                initialPosition.Append("/farmer 27 62 2");
            }
            else
            {
                if (IsWatchingPositionNorthEast(animalContestInfo))
                {
                    initialPosition.Append("/farmer 37 62 2");
                }
                else
                {
                    initialPosition.Append($"/farmer 28 70 {(IsWatchingPositionSouthEest(animalContestInfo)?"1":"3")}");
                }
            }

            initialPosition.Append(" Lewis 28 63 2");
            initialPosition.Append($" {contenders[0]} 24 66 3");
            initialPosition.Append($" {contenders[1]} 30 66 1");
            initialPosition.Append($" {contenders[2]} 33 66 1");
            if (isKentWatching)
            {
                initialPosition.Append($" Kent 36 66 3");
            }

            if (!contenders.Contains("Jodi"))
            {
                initialPosition.Append($" Jodi 36 65 3");
            }
            initialPosition.Append($" Sam 37 66 3");
            initialPosition.Append($" Gus 36 68 3");
            initialPosition.Append($" Evelyn 30 69 1");
            initialPosition.Append($" George 31 69 0");
            if (!contenders.Contains("Alex"))
            {
                initialPosition.Append($" Alex 31 70 0");
            }
            initialPosition.Append($" Pierre 26 69 1");
            initialPosition.Append($" Caroline 27 69 3");
            if (Game1.player.spouse != "Elliott")
            {
                initialPosition.Append($" Elliott 33 69 0");
            }
            if (!contenders.Contains("Willy"))
            {
                initialPosition.Append($" Willy 35 69 0");
            }
            if (isHaleyWatching)
            {
                initialPosition.Append($" Haley 22 68 1");
            }
            if (isLeahWatching)
            {
                initialPosition.Append($" Leah 22 70 0");
            }
            if (isSebastianWatching)
            {
                initialPosition.Append($" Sebastian 37 67 3");
            }
            else if (isPennyWatching)
            {
                initialPosition.Append($" Penny 37 67 3");
            }
            if (isDemetriusWatching)
            {
                initialPosition.Append($" Demetrius 32 70 0");
            }
            if (isClintWatching)
            {
                initialPosition.Append($" Clint 34 70 0");
            }
            if (isPlayerJustWatching)
            {
                initialPosition.Append($" Jas 27 66 0");
            }
            else if (!contenders.Contains("Jas"))
            {
                initialPosition.Append($" Jas 23 70 0");
            }
            if (isShaneWatching)
            {
                initialPosition.Append($" Shane 24 70 0");
            }

            bool linusAlternateAnimal = false;

            if (isLinusWatching)
            {
                initialPosition.Append($" Linus 37 70 3");
            }
            else
            {
                linusAlternateAnimal = history.Count(h => h.Contenders.Contains("Linus")) % 2 == new Random((int)Game1.uniqueIDForThisGame).Next(2);
            }

            if (Game1.player.spouse != null && !new string[] { "Shane", "Alex", "Sam", "Haley" }.Contains(Game1.player.spouse) &&
                !animalContestInfo.Contenders.Contains(Game1.player.spouse))
            {
                initialPosition.Append($" {Game1.player.spouse} 25 69 0");
            }

            initialPosition.Append($" Vincent 28 80 0");

            if (isParticipantPet)
            {
                if (!Game1.player.catPerson)
                {
                    initialPosition.Append(" dog 26 66 2/showFrame Dog 23");
                }
                else
                {
                    initialPosition.Append(" cat 26 66 2/positionOffset Cat -8 0/showFrame Cat 18");
                }
            }
            else
            {
                if (!isPlayerJustWatching)
                {
                    string spriteTextureName = farmAnimal.Sprite.textureName.Value;
                    string playerAnimalTextureName;
                    if (spriteTextureName.StartsWith("Animals\\"))
                    {
                        playerAnimalTextureName = farmAnimal.Sprite.textureName.Value
                                                  .Substring(farmAnimal.Sprite.textureName.Value.IndexOf('\\') + 1)
                                                  .Replace(' ', '_');
                    }
                    else
                    {
                        DataLoader.AssetsToLoad["Animals\\" + spriteTextureName.Replace('_', ' ')] = farmAnimal.Sprite.Texture;
                        playerAnimalTextureName = spriteTextureName.Replace(' ', '_');;
                    }
                    bool isPlayerAnimalSmall = IsAnimalSmall(farmAnimal);
                    initialPosition.Append($"/addTemporaryActor {playerAnimalTextureName} {(isPlayerAnimalSmall? SmallSize : BigSize)} {(isPlayerAnimalSmall?26:25)} 66 0 false Animal participant/showFrame participant 0");
                    if (!isPlayerAnimalSmall)
                    {
                        initialPosition.Append("/positionOffset participant 5 0");
                    }
                }
            }
            initialPosition.Append("/specificTemporarySprite animalContest/skippable");
            initialPosition.Append(GetContendersAnimalPosition(contenders, marnieAnimal, isPlayerJustWatching, linusAlternateAnimal));

            initialPosition.Append("/viewport 28 65 true");

            StringBuilder eventAction = new StringBuilder();

            if (isHaleyWatching)
            {
                eventAction.Append("/showFrame Haley 25");
            }
            if (contenders.Contains("Maru"))
            {
                eventAction.Append("/animate Maru false false 130 16 16 16 16 16 17 18 19 20 21 22 23 23 23 23");
            }
            string faceDirectionPlayerPosition;

            if (!isPlayerJustWatching)
            {
                faceDirectionPlayerPosition = "farmer";
                eventAction.Append("/move farmer 0 4 2/faceDirection farmer 3");
                if (isParticipantPet)
                {
                    eventAction.Append($"/playSound {(Game1.player.catPerson ? "cat" : "dog_bark")}");
                }
                eventAction.Append("/emote farmer 32");
                //eventAction.Append($"/emote {(isParticipantPet?!Game1.player.catPerson? "Dog":"Cat": "participant")} 20");
            }
            else
            {
                faceDirectionPlayerPosition = "Jas";
                if (IsWatchingPositionNorthEast(animalContestInfo))
                {
                    eventAction.Append("/move farmer 0 3 2/faceDirection farmer 3");
                }
                else if (IsWatchingPositionSouthEest(animalContestInfo))
                {
                    eventAction.Append("/move farmer 2 0 1/faceDirection farmer 0");
                }
                else
                {
                    eventAction.Append("/move farmer -3 0 3/faceDirection farmer 0");
                }
                if (Game1.player.spouse != null)
                {
                    eventAction.Append($"/emote {Game1.player.spouse} 20 true/emote farmer 20");
                }
            }

            if (isHaleyWatching)
            {
                eventAction.Append("/pause 200/playSound cameraNoise/shake Haley 50/screenFlash .5/pause 1000/showFrame Haley 5/pause 1000");
            }
            if (!isPlayerJustWatching)
            {
                eventAction.Append("/faceDirection farmer 0");
                eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.PlayerParticipant")}\"");
            }
            else
            {
                eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.PlayerWatching")}\"");
            }
            eventAction.Append($"/faceDirection {contenders[0]} 0");
            eventAction.Append($"/pause 1000/emote Lewis 40/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.Attention")}\"");

            eventAction.Append($"/pause 100/faceDirection {contenders[1]} 0 true");
            eventAction.Append($"/faceDirection Pierre 0");
            eventAction.Append($"/faceDirection {contenders[2]} 0 true");
            eventAction.Append($"/faceDirection Evelyn 0 true");
            if (!contenders.Contains("Willy"))
            {
                initialPosition.Append($"/faceDirection Willy 3");
            }
            eventAction.Append($"/faceDirection Caroline 0");

            if (history.Count == 0)
            {
                eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.IntroductionFirstTime")}\"");
            }
            else
            {
                eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.IntroductionOtherTimes")}\"");
            }

            eventAction.Append(new VincentAct().GetAct(animalContestInfo, history));

            eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.ContestExplanation")}\"");
            eventAction.Append($"/faceDirection {contenders[2]} 3 true");
            eventAction.Append("/move Lewis 0 1 2");
            eventAction.Append($"/faceDirection {contenders[0]} 3 true");
            eventAction.Append("/move Lewis 0 1 2");
            eventAction.Append($"/faceDirection {faceDirectionPlayerPosition} 3 true");
            eventAction.Append($"/faceDirection {contenders[1]} 3 true");
            eventAction.Append("/move Lewis 0 2 2");
            eventAction.Append("/move Lewis -5 0 3/faceDirection Lewis 0");
            eventAction.Append(new MarnieAct().GetAct(animalContestInfo, history));
            eventAction.Append($"/faceDirection Lewis 1/move Lewis 1 0 1/faceDirection {contenders[0]} 2 true/move Lewis 2 0 1/faceDirection {contenders[0]} 1 true/faceDirection Lewis 0");
            if (!isPlayerJustWatching)
            {
                eventAction.Append(GetPlayerAct(animalContestInfo, farmAnimal, history));
            }
            else
            {
                eventAction.Append(JasAct.GetAct(animalContestInfo, history));
            }
            eventAction.Append($"/faceDirection Lewis 1/move Lewis 1 0 1/faceDirection {faceDirectionPlayerPosition} 2 true/move Lewis 1 0 1/faceDirection {faceDirectionPlayerPosition} 1 true/move Lewis 1 0 1/faceDirection {contenders[1]} 2 true/move Lewis 2 0 1/faceDirection {contenders[1]} 1 true/faceDirection Lewis 0");
            eventAction.Append(PossibleSecondContenders.First(c => c.NpcName.Equals(contenders[1])).GetAct(animalContestInfo, history));
            eventAction.Append($"/faceDirection Lewis 1/move Lewis 1 0 1/faceDirection {contenders[2]} 2 true/move Lewis 2 0 1/faceDirection {contenders[2]} 1 true/faceDirection Lewis 0");
            eventAction.Append(PossibleThirdContenders.First(c => c.NpcName.Equals(contenders[2])).GetAct(animalContestInfo, history));
            eventAction.Append($"/playMusic event1/faceDirection Lewis 3/faceDirection Lewis 2/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.Closure")}\"");
            eventAction.Append($"/faceDirection Lewis 3/move Lewis -6 0 3/faceDirection Lewis 0/move Lewis 0 -4 0/faceDirection {contenders[1]} 0 true/faceDirection {contenders[0]} 0 true/faceDirection Lewis 3/faceDirection {contenders[2]} 0 true/faceDirection {faceDirectionPlayerPosition} 0 true/faceDirection Lewis 2");

            eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.ClosureThanks")}#$b#");
            if (history.Count == 0)
            {
                eventAction.Append($"{i18n.Get("AnimalContest.Dialog.Lewis.ClosureSuccessFirstTime")}\"");
            }
            else
            {
                eventAction.Append($"{i18n.Get("AnimalContest.Dialog.Lewis.ClosureSuccessOtherTimes")}\"");
            }
            String winnerAnimalName = animalContestInfo.Winner == "Farmer"
                ? farmAnimal.displayName
                : animalContestInfo.Winner == "Emily"
                    ? i18n.Get("AnimalContest.Dialog.Lewis.EmilyUnnamedParrot")
                    : "%name";
            String winnerName = animalContestInfo.Winner == "Farmer"?"@":animalContestInfo.Winner;

            eventAction.Append($"/stopMusic/pause 200/speak Lewis \"{ i18n.Get("AnimalContest.Dialog.Lewis.WinnerAnnouncement", new {winnerName, winnerAnimalName})}\"");
            eventAction.Append("/playMusic event1/emote Alex 56 true/pause 60");
            if (animalContestInfo.Winner == "Farmer")
            {
                eventAction.Append("/emote farmer 32 true/pause 500");
                if (Game1.player.spouse != null)
                {
                    eventAction.Append($"/textAboveHead {Game1.player.spouse} \"{i18n.Get("AnimalContest.Dialog.Spouse.PlayerCongrats")}\"/pause 1500");
                }
                if (Game1.player.getFriendshipHeartLevelForNPC("Gus") >= 4)
                {
                    eventAction.Append($"/textAboveHead Gus \"{i18n.Get("AnimalContest.Dialog.Gus.PlayerCongrats", new { playerName = Game1.player.Name })}\"/pause 1500");
                }
                else if (Game1.player.spouse != null)
                {
                    eventAction.Append($"/pause 1500");
                }
                if (Game1.player.getFriendshipHeartLevelForNPC("Pierre") >= 4)
                {
                    eventAction.Append($"/textAboveHead Pierre \"{i18n.Get("AnimalContest.Dialog.Pierre.PlayerCongrats", new { playerName = Game1.player.Name })}\"/pause 1500");
                }
                if (isLinusWatching && Game1.player.getFriendshipHeartLevelForNPC("Linus") >= 4)
                {
                    eventAction.Append($"/textAboveHead Linus \"{i18n.Get("AnimalContest.Dialog.Linus.PlayerCongrats", new { playerName = Game1.player.Name })}\"/pause 1500");
                }
                else if (Game1.player.getFriendshipHeartLevelForNPC("Pierre") >= 4)
                {
                    eventAction.Append($"/pause 1500");
                }
            }
            else if (animalContestInfo.Winner == "Marnie")
            {
                eventAction.Append("/specificTemporarySprite animalContestMarnieWinning/warp Marnie -2000 -2000/pause 500");
                eventAction.Append($"/emote Jas 32 true/pause 1500");
                if (isShaneWatching || animalContestInfo.Contenders.Contains("Shane"))
                {
                    eventAction.Append($"/textAboveHead Shane \"{i18n.Get("AnimalContest.Dialog.Shane.MarnieCongrats")}\"/pause 1000");
                }
            }
            else if (animalContestInfo.Winner == "Shane")
            {
                eventAction.Append("/emote Shane 16 true/emote shaneAnimal 20 true");
                eventAction.Append($"/pause 500/emote Jas 32 true/pause 500/textAboveHead Marnie \"{i18n.Get("AnimalContest.Dialog.Marnie.ShaneContrats")}\"/pause 1000");
            }
            else if (animalContestInfo.Winner == "Emily")
            {
                eventAction.Append("/specificTemporarySprite animalContestEmilyParrotAction/emote Emily 20 true");
                eventAction.Append($"/textAboveHead Clint \"{i18n.Get("AnimalContest.Dialog.Clint.EmilyContrats")}\"/pause 500");
                if (isHaleyWatching)
                {
                    eventAction.Append($"/textAboveHead Haley \"{i18n.Get("AnimalContest.Dialog.Haley.EmilyContrats")}\"/pause 500");
                }
                eventAction.Append($"/pause 1000/textAboveHead Gus \"{i18n.Get("AnimalContest.Dialog.Gus.EmilyContrats")}\"/pause 1000");
            }
            else if (animalContestInfo.Winner == "Jodi")
            {
                eventAction.Append("/emote jodiAnimal 20 true/emote Jodi 32 true/pause 1000");
                if (isKentWatching)
                {
                    eventAction.Append($"/textAboveHead Kent \"{i18n.Get("AnimalContest.Dialog.Kent.JodiContrats")}\"/pause 1500");
                }
                eventAction.Append($"/textAboveHead Caroline \"{i18n.Get("AnimalContest.Dialog.Caroline.JodiContrats")}\"/pause 1500");
                eventAction.Append($"/textAboveHead Sam \"{i18n.Get("AnimalContest.Dialog.Sam.JodiContrats")}\"/pause 1500");
            }
            eventAction.Append($"/textAboveHead Evelyn \"{i18n.Get("AnimalContest.Dialog.Evelyn.Contrats")}\"");
            if (isHaleyWatching)
            {
                eventAction.Append("/showFrame Haley 25/pause 1000/playSound cameraNoise/shake Haley 50/screenFlash .5/pause 1000/showFrame Haley 5/pause 1500");
            }
            else
            {
                eventAction.Append($"/pause 3000");
            }

            eventAction.Append($"/speak Lewis \"{i18n.Get("AnimalContest.Dialog.Lewis.Ending")}\"/faceDirection Lewis 3/move Lewis -2 0 3 true");
            if (animalContestInfo.Winner != "Marnie")
            {
                eventAction.Append($"/faceDirection Marnie 0/move Marnie 0 -2 0 true");
            }
            eventAction.Append($"/pause 1500/showFrame Lewis 16/globalFade/viewport -1000 -1000");
            if (animalContestInfo.Winner == "Farmer" && !DataLoader.ModConfig.DisableContestBonus)
            {
                string bonusType = contestDate.Season == "spring" || contestDate.Season == "summer" ? i18n.Get("AnimalContest.Message.Reward.Fertility") : i18n.Get("AnimalContest.Message.Reward.Production");
                eventAction.Append($"/playSound reward/message \"{i18n.Get("AnimalContest.Message.Reward", new { animalName = farmAnimal.displayName, bonusType })}\"");
            }
            eventAction.Append("/specificTemporarySprite animalContestEnding/end");

            string script = initialPosition.ToString() + eventAction.ToString();

            FarmerLoader.FarmerData.AnimalContestData.Add(animalContestInfo);

            return(new CustomEvent(key, script));
        }
        private static void MakeAnimalParticipant(long id)
        {
            AnimalStatus animalStatus = GetAnimalStatus(id);

            animalStatus.DayParticipatedContest = GetNextContestDate();
        }
        public static long?ContestParticipantId(SDate contestDate)
        {
            AnimalStatus animalStatus = FarmerLoader.FarmerData.AnimalData.Find(s => s.DayParticipatedContest == contestDate);

            return(animalStatus?.Id);
        }
        private static void RemoveAnimalParticipant(long id)
        {
            AnimalStatus animalStatus = GetAnimalStatus(id);

            animalStatus.DayParticipatedContest = null;
        }