Ejemplo n.º 1
0
        public static void ResetSharedState_Postfix(
            CommunityCenter __instance)
        {
            if (Game1.MasterPlayer.mailReceived.Contains("JojaMember"))
            {
                return;
            }

            if (__instance.areAllAreasComplete())
            {
                if (Bundles.AreAnyCustomAreasLoaded())
                {
                    __instance.numberOfStarsOnPlaque.Value += 1;
                }
            }
            else
            {
                if (__instance.mapPath.Value == "Maps\\CommunityCenter_Refurbished")
                {
                    // When all base areas are complete,
                    // CommunityCenter.TransferDataFromSavedLocation() will call CommunityCenter.areAllAreasComplete(),
                    // which will return true and set the map as if the CC were complete.
                    // If any custom areas are incomplete,
                    // we undo the map change here to revert to the incomplete state map.
                    __instance.mapPath.Value = "Maps\\CommunityCenter_Ruins";
                    __instance.updateMap();
                }
                foreach (int areaNumber in Bundles.CustomAreasComplete.Keys)
                {
                    if (Bundles.ShouldNoteAppearInCustomArea(cc: __instance, areaNumber: areaNumber))
                    {
                        string areaName = Bundles.GetCustomAreaNameFromNumber(areaNumber);
                        CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetAllCustomBundleMetadataEntries()
                                                                                   .First(bmd => bmd.AreaName == areaName);

                        Vector2 tileLocation = Utility.PointToVector2(bundleMetadata.NoteTileLocation + bundleMetadata.JunimoOffsetFromNoteTileLocation);

                        Junimo j = new (position : tileLocation * Game1.tileSize, whichArea : areaNumber);
                        __instance.characters.Add(j);
                    }
                }
            }

            CustomCommunityCentre.Events.Game.InvokeOnResetSharedState(communityCentre: __instance);
        }
Ejemplo n.º 2
0
        public static void ShouldNoteAppearInArea_Postfix(
            CommunityCenter __instance,
            ref bool __result,
            int area)
        {
            if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || !Bundles.IsCustomArea(area) || !Bundles.AreAnyCustomAreasLoaded())
            {
                return;
            }

            __result = Bundles.ShouldNoteAppearInCustomArea(cc: __instance, areaNumber: area);
        }