示例#1
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);
            }
        }
示例#2
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;
        }