public static void Junimo_ctor_Postfix( Junimo __instance, Vector2 position, int whichArea) { if (whichArea >= Bundles.CustomAreaInitialIndex && !Bundles.IsAbandonedJojaMartBundleAvailableOrComplete()) { CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetAllCustomBundleMetadataEntries() .First(bmd => Bundles.GetCustomAreaNumberFromName(bmd.AreaName) == whichArea); __instance.friendly.Value = Bundles.IsAreaComplete(cc: Bundles.CC, areaNumber: whichArea); int restoreAreaPhase = Reflection.GetField <int> (obj: Bundles.CC, name: "restoreAreaPhase") .GetValue(); if (restoreAreaPhase != CommunityCenter.PHASE_junimoAppear) { Reflection.GetField <Netcode.NetColor> (obj: __instance, name: "color") .GetValue() .Set(bundleMetadata.Colour); } } }
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); }
public static void AreaNumberFromName_Postfix( // Static ref int __result, string name) { int id = Bundles.GetCustomAreaNumberFromName(areaName: name); if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || id < 0) { return; } __result = id; }
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; }
// Not applied in .NET Framework versions below 5.0: FatalExecutionEngineError public static void GetNotePosition_Postfix( CommunityCenter __instance, ref Point __result, int area) { CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetCustomBundleMetadataFromAreaNumber(area); if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || bundleMetadata == null) { return; } __result = bundleMetadata.NoteTileLocation; }
public static void JunimoNoteMenu_ctor_Postfix( JunimoNoteMenu __instance, bool fromGameMenu, int area, bool fromThisMenu) { CommunityCenter cc = Bundles.CC; if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete()) { return; } IReflectedField <int> whichAreaField = Reflection.GetField <int> (__instance, "whichArea"); bool isAreaSet = false; bool isNavigationSet = false; foreach (string areaName in Bundles.GetAllAreaNames()) { int areaNumber = CommunityCenter.getAreaNumberFromName(areaName); // Set default area for menu view with custom areas if (!isAreaSet && fromGameMenu && !fromThisMenu && !isAreaSet && cc.shouldNoteAppearInArea(areaNumber) && !Bundles.IsAreaComplete(cc: cc, areaNumber: areaNumber)) { area = areaNumber; whichAreaField.SetValue(area); isAreaSet = true; } // Show navigation arrows when custom areas if (!isNavigationSet && areaNumber >= 0 && areaNumber != area && cc.shouldNoteAppearInArea(areaNumber)) { __instance.areaNextButton.visible = true; __instance.areaBackButton.visible = true; isNavigationSet = true; } if (isAreaSet && isNavigationSet) { break; } } }
public static void GetRewardNameForArea_Postfix( JunimoNoteMenu __instance, int whichArea, ref string __result) { CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetCustomBundleMetadataFromAreaNumber(whichArea); if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || bundleMetadata == null) { return; } __result = CustomCommunityCentre.Data.BundleMetadata.GetLocalisedString( dict: bundleMetadata.AreaRewardMessage, defaultValue: "???"); }
public static void AreaDisplayNameFromNumber_Postfix( // Static ref string __result, int areaNumber) { CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetCustomBundleMetadataFromAreaNumber(areaNumber); if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || bundleMetadata == null) { return; } string displayName = CustomCommunityCentre.Data.BundleMetadata.GetLocalisedString( dict: bundleMetadata.AreaDisplayName, defaultValue: bundleMetadata.AreaName); __result = displayName; }
public static void AreaNumberFromLocation_Postfix( CommunityCenter __instance, ref int __result, Vector2 tileLocation) { CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetAllCustomBundleMetadataEntries() .FirstOrDefault(bmd => bmd.AreaBounds.Contains(Utility.Vector2ToPoint(tileLocation))); int areaNumber = bundleMetadata != null ? Bundles.GetCustomAreaNumberFromName(bundleMetadata.AreaName) : -1; if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete() || areaNumber < 0) { return; } __result = areaNumber; }
internal static void DayStartedBehaviours(CommunityCenter cc) { // Load in new community centre area-bundle data if ready if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete()) { Log.D("Community centre and abandoned joja-mart complete, doing nothing.", ModEntry.Config.DebugMode); } else if (Bundles.IsCommunityCentreDefinitelyComplete(cc)) { Log.D("Community centre complete, unloading any bundle data.", ModEntry.Config.DebugMode); BundleManager.Save(cc); } else { Log.D("Community centre incomplete, loading bundle data.", ModEntry.Config.DebugMode); BundleManager.Load(cc); } }
public static void GetAreaBounds_Postfix( CommunityCenter __instance, ref Rectangle __result, int area) { CustomCommunityCentre.Data.BundleMetadata bundleMetadata = Bundles.GetCustomBundleMetadataFromAreaNumber(area); if (Bundles.IsAbandonedJojaMartBundleAvailableOrComplete()) { return; } // Override any overlapping bundle areas foreach (CustomCommunityCentre.Data.BundleMetadata bmd in Bundles.GetAllCustomBundleMetadataEntries()) { if (bmd.AreaName != bundleMetadata?.AreaName && __result != Rectangle.Empty) { Rectangle intersection = Rectangle.Intersect(__result, bmd.AreaBounds); if (intersection.Width > 0) { __result.X += intersection.Width; __result.Width -= intersection.Width; } intersection = Rectangle.Intersect(__result, bmd.AreaBounds); if (intersection.Height > 0) { __result.Y += intersection.Height; __result.Height -= intersection.Height; } } } // Apply area bounds to custom areas if (bundleMetadata != null) { __result = bundleMetadata.AreaBounds; } }
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; }