Esempio n. 1
0
        public static void AreaNameFromNumber_Postfix(
            CommunityCenter __instance,
            ref string __result,
            int areaNumber)
        {
            string name = Bundles.GetCustomAreaNameFromNumber(areaNumber: areaNumber);

            if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || string.IsNullOrEmpty(name))
            {
                return;
            }

            __result = name;
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public static void GetMessageForAreaCompletion_Postfix(
            CommunityCenter __instance,
            ref string __result)
        {
            int areaNumber = Reflection.GetField
                             <int>
                                 (obj: __instance, name: "restoreAreaIndex")
                             .GetValue();
            string areaName           = Bundles.GetCustomAreaNameFromNumber(areaNumber);
            string areaNameAsAssetKey = Bundles.GetAreaNameAsAssetKey(areaName);

            if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() ||
                !Bundles.IsCustomArea(areaNumber) ||
                string.IsNullOrWhiteSpace(areaName))
            {
                return;
            }

            string message = Game1.content.LoadString(
                $"Strings\\Locations:CommunityCenter_AreaCompletion_{areaNameAsAssetKey}",
                Game1.player.Name);

            __result = message;
        }