예제 #1
0
 public override void TransferDataFromSavedLocation(GameLocation l)
 {
     if (l is IslandSouth)
     {
         IslandSouth location = l as IslandSouth;
         resortRestored.Value     = location.resortRestored.Value;
         westernTurtleMoved.Value = location.westernTurtleMoved.Value;
         shouldToggleResort.Value = location.shouldToggleResort.Value;
         resortOpenToday.Value    = location.resortOpenToday.Value;
     }
     base.TransferDataFromSavedLocation(l);
 }
예제 #2
0
        public static void SetupIslandSchedules()
        {
            Game1.netWorldState.Value.IslandVisitors.Clear();
            if (Utility.isFestivalDay(Game1.Date.DayOfMonth, Game1.Date.Season) || (Game1.Date.Season == "winter" && Game1.Date.DayOfMonth >= 15 && Game1.Date.DayOfMonth <= 17))
            {
                return;
            }
            IslandSouth island = Game1.getLocationFromName("IslandSouth") as IslandSouth;

            if (island == null || !island.resortRestored.Value || Game1.IsRainingHere(island) || !island.resortOpenToday.Value)
            {
                return;
            }
            Random     seeded_random  = new Random((int)((float)Game1.uniqueIDForThisGame * 1.21f) + (int)((float)Game1.stats.DaysPlayed * 2.5f));
            List <NPC> valid_visitors = new List <NPC>();

            foreach (NPC npc in Utility.getAllCharacters())
            {
                if (CanVisitIslandToday(npc))
                {
                    valid_visitors.Add(npc);
                }
            }
            List <NPC> visitors = new List <NPC>();

            if (seeded_random.NextDouble() < 0.4)
            {
                for (int k = 0; k < 5; k++)
                {
                    NPC visitor4 = Utility.GetRandom(valid_visitors, seeded_random);
                    if (visitor4 != null && (int)visitor4.age != 2)
                    {
                        valid_visitors.Remove(visitor4);
                        visitors.Add(visitor4);
                        visitor4.scheduleDelaySeconds = Math.Min((float)k * 0.6f, 7f);
                    }
                }
            }
            else
            {
                List <List <string> > potentialGroups = new List <List <string> >();
                potentialGroups.Add(new List <string>
                {
                    "Sebastian",
                    "Sam",
                    "Abigail"
                });
                potentialGroups.Add(new List <string>
                {
                    "Jodi",
                    "Kent",
                    "Vincent",
                    "Sam"
                });
                potentialGroups.Add(new List <string>
                {
                    "Jodi",
                    "Vincent",
                    "Sam"
                });
                potentialGroups.Add(new List <string>
                {
                    "Pierre",
                    "Caroline",
                    "Abigail"
                });
                potentialGroups.Add(new List <string>
                {
                    "Robin",
                    "Demetrius",
                    "Maru",
                    "Sebastian"
                });
                potentialGroups.Add(new List <string>
                {
                    "Lewis",
                    "Marnie"
                });
                potentialGroups.Add(new List <string>
                {
                    "Marnie",
                    "Shane",
                    "Jas"
                });
                potentialGroups.Add(new List <string>
                {
                    "Penny",
                    "Jas",
                    "Vincent"
                });
                potentialGroups.Add(new List <string>
                {
                    "Pam",
                    "Penny"
                });
                potentialGroups.Add(new List <string>
                {
                    "Caroline",
                    "Marnie",
                    "Robin",
                    "Jodi"
                });
                potentialGroups.Add(new List <string>
                {
                    "Haley",
                    "Penny",
                    "Leah",
                    "Emily",
                    "Maru",
                    "Abigail"
                });
                potentialGroups.Add(new List <string>
                {
                    "Alex",
                    "Sam",
                    "Sebastian",
                    "Elliott",
                    "Shane",
                    "Harvey"
                });
                List <string> group  = potentialGroups[seeded_random.Next(potentialGroups.Count)];
                bool          failed = false;
                foreach (string s in group)
                {
                    if (!valid_visitors.Contains(Game1.getCharacterFromName(s)))
                    {
                        failed = true;
                        break;
                    }
                }
                if (!failed)
                {
                    int j = 0;
                    foreach (string item in group)
                    {
                        NPC visitor3 = Game1.getCharacterFromName(item);
                        valid_visitors.Remove(visitor3);
                        visitors.Add(visitor3);
                        visitor3.scheduleDelaySeconds = Math.Min((float)j * 0.6f, 7f);
                        j++;
                    }
                }
                for (int i = 0; i < 5 - visitors.Count; i++)
                {
                    NPC visitor = Utility.GetRandom(valid_visitors, seeded_random);
                    if (visitor != null && (int)visitor.age != 2)
                    {
                        valid_visitors.Remove(visitor);
                        visitors.Add(visitor);
                        visitor.scheduleDelaySeconds = Math.Min((float)i * 0.6f, 7f);
                    }
                }
            }
            List <IslandActivityAssigments> activities = new List <IslandActivityAssigments>();
            Dictionary <Character, string>  last_activity_assignments = new Dictionary <Character, string>();

            activities.Add(new IslandActivityAssigments(1200, visitors, seeded_random, last_activity_assignments));
            activities.Add(new IslandActivityAssigments(1400, visitors, seeded_random, last_activity_assignments));
            activities.Add(new IslandActivityAssigments(1600, visitors, seeded_random, last_activity_assignments));
            last_activity_assignments = null;
            foreach (NPC visitor2 in visitors)
            {
                StringBuilder schedule           = new StringBuilder("");
                bool          should_dress       = HasIslandAttire(visitor2);
                bool          had_first_activity = false;
                if (should_dress)
                {
                    Point dressing_room2 = GetDressingRoomPoint(visitor2);
                    schedule.Append("/a1150 IslandSouth " + dressing_room2.X + " " + dressing_room2.Y + " change_beach");
                    had_first_activity = true;
                }
                foreach (IslandActivityAssigments item2 in activities)
                {
                    string current_string = item2.GetScheduleStringForCharacter(visitor2);
                    if (current_string != "")
                    {
                        if (!had_first_activity)
                        {
                            current_string     = "/a" + current_string.Substring(1);
                            had_first_activity = true;
                        }
                        schedule.Append(current_string);
                    }
                }
                if (should_dress)
                {
                    Point dressing_room = GetDressingRoomPoint(visitor2);
                    schedule.Append("/a1730 IslandSouth " + dressing_room.X + " " + dressing_room.Y + " change_normal");
                }
                if (visitor2.Name == "Gus")
                {
                    schedule.Append("/1800 Saloon 10 18 2/2430 bed");
                }
                else
                {
                    schedule.Append("/1800 bed");
                }
                schedule.Remove(0, 1);
                visitor2.islandScheduleName.Value = "island";
                visitor2.Schedule = visitor2.parseMasterSchedule(schedule.ToString());
                Game1.netWorldState.Value.IslandVisitors[visitor2.Name] = true;
            }
        }