コード例 #1
0
        public static bool MarkAreaAsComplete_Prefix(
            CommunityCenter __instance,
            int area)
        {
            try
            {
                if (Bundles.IsCustomArea(area))
                {
                    if (Game1.currentLocation is CommunityCenter)
                    {
                        Bundles.CustomAreasComplete[area] = true;

                        if (__instance.areAllAreasComplete())
                        {
                            Reflection.GetField
                            <bool>
                                (obj: __instance, name: "_isWatchingJunimoGoodbye")
                            .SetValue(true);
                        }
                    }
                    return(false);
                }
            }
            catch (Exception e)
            {
                HarmonyPatches.ErrorHandler(e);
            }
            return(true);
        }
コード例 #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);
        }
コード例 #3
0
        public static void DoAreaCompleteReward_Postfix(
            CommunityCenter __instance,
            int whichArea)
        {
            string areaName = CommunityCenter.getAreaNameFromNumber(whichArea);

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

            string mail = string.Format(Bundles.MailAreaCompleted, Bundles.GetAreaNameAsAssetKey(areaName));

            if (Bundles.IsCustomAreaComplete(areaNumber: whichArea) && !Game1.player.hasOrWillReceiveMail(mail))
            {
                // Add some mail flag to this bundle to indicate completion
                Log.D($"Sending mail for custom bundle completion ({mail})",
                      CustomCommunityCentre.ModEntry.Config.DebugMode);
                Game1.addMailForTomorrow(mail, noLetter: true);
            }
        }
コード例 #4
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;
        }