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 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); }
public static void MakeMapModifications_Postfix( CommunityCenter __instance) { if (!Game1.MasterPlayer.mailReceived.Contains("JojaMember") && !__instance.areAllAreasComplete()) { foreach (int areaNumber in Bundles.CustomAreasComplete.Keys) { bool isAvailable = Bundles.ShouldNoteAppearInCustomArea(cc: __instance, areaNumber: areaNumber); bool isComplete = Bundles.IsCustomAreaComplete(areaNumber); if (isAvailable) { __instance.addJunimoNote(area: areaNumber); } else if (isComplete) { __instance.loadArea(area: areaNumber, showEffects: false); } } } }
public static void DoCheckForNewJunimoNotes_Postfix( CommunityCenter __instance) { if (!(Game1.currentLocation is CommunityCenter)) { return; } foreach (int areaNumber in Bundles.CustomAreasComplete.Keys) { Point p = Reflection.GetMethod(obj: __instance, name: "getNotePosition").Invoke <Point>(areaNumber); bool isNoteSuperAtAreaAreYouSure = __instance.Map.GetLayer("Buildings").Tiles[p.X, p.Y] is xTile.Tiles.Tile tile && tile != null && tile.TileIndex != 0; bool isNoteAtArea = __instance.isJunimoNoteAtArea(areaNumber); bool isNoteReady = Bundles.ShouldNoteAppearInCustomArea(cc: __instance, areaNumber: areaNumber); if (!(isNoteAtArea && isNoteSuperAtAreaAreYouSure) && isNoteReady) { __instance.addJunimoNoteViewportTarget(areaNumber); } } }