/// <summary>Get the data to display for this subject.</summary>
        public override IEnumerable <ICustomField> GetData()
        {
            // mermaid puzzle
            {
                IslandSouthEast location = (IslandSouthEast)this.Location;
                bool            complete = location.mermaidPuzzleFinished.Value;

                if (this.ProgressionMode && !complete)
                {
                    yield return(new GenericField(I18n.Puzzle_Solution(), I18n.Puzzle_Solution_Hidden()));
                }
                else
                {
                    int[] sequence  = this.GameHelper.Metadata.PuzzleSolutions.IslandMermaidFluteBlockSequence;
                    int   songIndex = location.songIndex;

                    var checkboxes = sequence
                                     .Select((pitch, i) => CheckboxListField.Checkbox(text: this.Stringify(pitch), value: complete || songIndex >= i))
                                     .ToArray();

                    yield return(new CheckboxListField(I18n.Puzzle_Solution(), checkboxes)
                                 .AddIntro(complete ? I18n.Puzzle_Solution_Solved() : I18n.Puzzle_IslandMermaid_Solution_Intro()));
                }
            }

            // raw map data
            foreach (ICustomField field in base.GetData())
            {
                yield return(field);
            }
        }
예제 #2
0
        internal static void DrawPatch(IslandSouthEast __instance, SpriteBatch b)
        {
            if (!ModEntry.ShouldMurphyAppear(__instance) && __instance.currentEvent is null)
            {
                // Skip this draw patch if Murphy isn't here today
                return;
            }

            Texture2D boatTexture = ModResources.boatTexture;

            if (boatTexture != null)
            {
                b.Draw(boatTexture, Game1.GlobalToLocal(ModEntry.trawlerObject.GetTrawlerPosition()), new Rectangle(0, 16, 224, 160), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                if (ModEntry.trawlerObject._closeGate)
                {
                    b.Draw(boatTexture, Game1.GlobalToLocal(new Vector2(107f, 16f) * 4f + ModEntry.trawlerObject.GetTrawlerPosition()), new Rectangle(251, 32, 18, 15), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.07f);
                }
                else
                {
                    b.Draw(boatTexture, Game1.GlobalToLocal(new Vector2(106f, 7f) * 4f + ModEntry.trawlerObject.GetTrawlerPosition()), new Rectangle(282, 23, 4, 24), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.07f);
                }
            }

            // Draw the Murphy NPC
            if (ModEntry.murphyNPC != null)
            {
                ModEntry.murphyNPC.draw(b);
            }
        }
예제 #3
0
        internal static void CheckActionPatch(IslandSouthEast __instance, ref bool __result, xTile.Dimensions.Location tileLocation, xTile.Dimensions.Rectangle viewport, Farmer who)
        {
            if (__result)
            {
                return;
            }

            if (ModEntry.murphyNPC != null && ModEntry.murphyNPC.getTileX() == tileLocation.X && Enumerable.Range(ModEntry.murphyNPC.getTileY() - 1, 3).Contains(tileLocation.Y))
            {
                __result = ModEntry.murphyNPC.checkAction(who, __instance);
                return;
            }

            // Check to see if player is trying to access Trawler's reward chest
            Tile tile = __instance.map.GetLayer("Buildings").PickTile(new xTile.Dimensions.Location(tileLocation.X * 64, tileLocation.Y * 64), viewport.Size);

            if (tile is null || !tile.Properties.ContainsKey("CustomAction"))
            {
                return;
            }

            switch (tile.Properties["CustomAction"].ToString())
            {
            case "TrawlerRewardStorage":
                __result = true;

                if (ModEntry.rewardChest.items.Count() == 0)
                {
                    Game1.drawObjectDialogue(ModEntry.i18n.Get("game_message.empty_crate"));
                    break;
                }

                __instance.playSound("fishSlap");
                ModEntry.rewardChest.ShowMenu();
                break;

            case "TrawlerNote":
                if (!who.mailReceived.Contains("PeacefulEnd.FishingTrawler_WillyIntroducesMurphy"))
                {
                    Game1.drawObjectDialogue(ModEntry.i18n.Get("game_message.messy_note"));
                    break;
                }

                if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en)
                {
                    Game1.drawObjectDialogue(String.Format("There's a note here...#It is from Murphy! It says he will be docked every {0} and to speak with him before nightfall if you wish to go on a fishing trip.", Game1.MasterPlayer.modData[ModEntry.MURPHY_DAY_TO_APPEAR_ISLAND]));
                    break;
                }

                Game1.drawObjectDialogue(String.Format(ModEntry.i18n.Get("game_message.readable_note"), Game1.MasterPlayer.modData[ModEntry.MURPHY_DAY_TO_APPEAR]));
                break;

            default:
                break;
            }
        }
예제 #4
0
        internal static void UpdateWhenCurrentLocationPatch(IslandSouthEast __instance, GameTime time)
        {
            // Update the Murphy NPC
            if (ModEntry.ShouldMurphyAppear(__instance) && ModEntry.murphyNPC == null)
            {
                ModEntry.SpawnMurphy(__instance);
            }

            if (ModEntry.murphyNPC != null)
            {
                ModEntry.murphyNPC.update(time, __instance);

                if (__instance.modData.ContainsKey(ModEntry.MURPHY_ON_TRIP) && __instance.modData[ModEntry.MURPHY_ON_TRIP] == "true")
                {
                    ModEntry.murphyNPC = null;
                }
            }

            // Update the appearance of the reward chest
            if (ModEntry.rewardChest.items.Count() == 0 && __instance.getTileIndexAt(new Point(5, 39), "Buildings") != 10)
            {
                SwapRewardChestTiles(__instance, 10);
            }
            else if (ModEntry.rewardChest.items.Count() > 0 && __instance.getTileIndexAt(new Point(5, 39), "Buildings") != 0)
            {
                SwapRewardChestTiles(__instance, 0);
            }

            Trawler trawler = ModEntry.trawlerObject;

            if (trawler is null)
            {
                return;
            }

            if (trawler._boatDirection != 0)
            {
                trawler._boatOffset += trawler._boatDirection;
                if (__instance.currentEvent != null)
                {
                    foreach (NPC actor in __instance.currentEvent.actors)
                    {
                        actor.shouldShadowBeOffset = true;
                        actor.drawOffset.X         = trawler._boatOffset;
                    }
                    foreach (Farmer farmerActor in __instance.currentEvent.farmerActors)
                    {
                        farmerActor.shouldShadowBeOffset = true;
                        farmerActor.drawOffset.X         = trawler._boatOffset;
                    }
                }
            }

            Microsoft.Xna.Framework.Rectangle back_rectangle = new Microsoft.Xna.Framework.Rectangle(24, 188, 16, 220);
            back_rectangle.X += (int)trawler.GetTrawlerPosition().X;
            back_rectangle.Y += (int)trawler.GetTrawlerPosition().Y;
            if ((float)trawler._boatDirection != 0f)
            {
                if (trawler._nextBubble > 0f)
                {
                    trawler._nextBubble -= (float)time.ElapsedGameTime.TotalSeconds;
                }
                else
                {
                    Vector2 position2 = Utility.getRandomPositionInThisRectangle(back_rectangle, Game1.random);
                    TemporaryAnimatedSprite sprite2 = new TemporaryAnimatedSprite("TileSheets\\animations", new Microsoft.Xna.Framework.Rectangle(0, 0, 64, 64), 50f, 9, 1, position2, flicker: false, flipped: false, 0f, 0.025f, Color.White, 1f, 0f, 0f, 0f);
                    sprite2.acceleration = new Vector2(-0.25f * (float)Math.Sign(trawler._boatDirection), 0f);
                    if (Context.IsSplitScreen)
                    {
                        ModEntry.multiplayer.broadcastSprites(__instance, sprite2);
                    }
                    else
                    {
                        __instance.temporarySprites.Add(sprite2);
                    }
                    trawler._nextBubble = 0.01f;
                }
                if (trawler._nextSlosh > 0f)
                {
                    trawler._nextSlosh -= (float)time.ElapsedGameTime.TotalSeconds;
                }
                else
                {
                    Game1.playSound("waterSlosh");
                    trawler._nextSlosh = 0.5f;
                }
            }
            if (trawler._boatAnimating)
            {
                if (trawler._nextSmoke > 0f)
                {
                    trawler._nextSmoke -= (float)time.ElapsedGameTime.TotalSeconds;
                    return;
                }
                Vector2 position = new Vector2(158f, -32f) * 4f + trawler.GetTrawlerPosition();
                TemporaryAnimatedSprite sprite = new TemporaryAnimatedSprite("TileSheets\\animations", new Microsoft.Xna.Framework.Rectangle(0, 1600, 64, 128), 200f, 9, 1, position, flicker: false, flipped: false, 1f, 0.025f, Color.Gray, 1f, 0.025f, 0f, 0f);
                sprite.acceleration = new Vector2(-0.25f, -0.15f);
                __instance.temporarySprites.Add(sprite);
                trawler._nextSmoke = 0.2f;
            }
        }
예제 #5
0
 internal static void CleanupBeforePlayerExitPatch(IslandSouthEast __instance)
 {
     ModEntry.trawlerObject.Reset();
     ModEntry.murphyNPC = null;
 }
예제 #6
0
        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            // Set up notification messages
            MESSAGE_EVERYTHING_FAILING = new KeyValuePair <string, int>(i18n.Get("status_message.ship_falling_apart"), 10);
            MESSAGE_LOSING_FISH        = new KeyValuePair <string, int>(i18n.Get("status_message.losing_fish"), 9);
            MESSAGE_MAX_LEAKS          = new KeyValuePair <string, int>(i18n.Get("status_message.taking_on_water"), 8);
            MESSAGE_MULTI_PROBLEMS     = new KeyValuePair <string, int>(i18n.Get("status_message.lots_of_problems"), 7);
            MESSAGE_ENGINE_PROBLEM     = new KeyValuePair <string, int>(i18n.Get("status_message.engine_failing"), 7);
            MESSAGE_NET_PROBLEM        = new KeyValuePair <string, int>(i18n.Get("status_message.nets_torn"), 6);
            MESSAGE_LEAK_PROBLEM       = new KeyValuePair <string, int>(i18n.Get("status_message.leak"), 5);

            todayDayOfWeek = SDate.Now().DayOfWeek.ToString();

            Beach beach = Game1.getLocationFromName("Beach") as Beach;

            beach.modData[MURPHY_ON_TRIP] = "false";

            IslandSouthEast island = Game1.getLocationFromName("IslandSouthEast") as IslandSouthEast;

            island.modData[MURPHY_ON_TRIP] = "false";

            // Set Farmer moddata used for this mod
            EstablishPlayerData();

            if (Context.IsMainPlayer)
            {
                // Must be a user set date (default Wednesday), the player's fishing level >= 3 and the bridge must be fixed on the beach
                if (!Game1.MasterPlayer.mailReceived.Contains("PeacefulEnd.FishingTrawler_WillyIntroducesMurphy") && Game1.MasterPlayer.FishingLevel >= config.minimumFishingLevel && beach.bridgeFixed && todayDayOfWeek == Game1.MasterPlayer.modData[MURPHY_DAY_TO_APPEAR])
                {
                    Monitor.Log($"Sending {Game1.MasterPlayer.Name} intro letter about Murphy!", LogLevel.Trace);
                    Helper.Content.AssetEditors.Add(new CustomMail());
                    Game1.MasterPlayer.mailbox.Add("PeacefulEnd.FishingTrawler_WillyIntroducesMurphy");
                }

                // Must be a user set island date (default Satuday), met Murphy and Ginger Island's resort must be built
                IslandSouth resort = Game1.getLocationFromName("IslandSouth") as IslandSouth;
                if (!Game1.MasterPlayer.mailReceived.Contains("PeacefulEnd.FishingTrawler_MurphyGingerIsland") && Game1.MasterPlayer.mailReceived.Contains("PeacefulEnd.FishingTrawler_WillyIntroducesMurphy") && resort.resortRestored && todayDayOfWeek == Game1.MasterPlayer.modData[MURPHY_DAY_TO_APPEAR_ISLAND])
                {
                    Monitor.Log($"Sending {Game1.MasterPlayer.Name} Ginger Island letter about Murphy!", LogLevel.Trace);
                    Helper.Content.AssetEditors.Add(new CustomMail());
                    Game1.MasterPlayer.mailbox.Add("PeacefulEnd.FishingTrawler_MurphyGingerIsland");
                }
            }

            // Reset ownership of boat, deckhands
            mainDeckhand      = null;
            numberOfDeckhands = 0;

            // Set the reward chest
            Vector2 rewardChestPosition = new Vector2(-100, -100);
            Farm    farm = Game1.getLocationFromName("Farm") as Farm;

            rewardChest = farm.objects.Values.FirstOrDefault(o => o.modData.ContainsKey(REWARD_CHEST_DATA_KEY)) as Chest;
            if (rewardChest is null)
            {
                Monitor.Log($"Creating reward chest {rewardChestPosition}", LogLevel.Trace);
                rewardChest = new Chest(true, rewardChestPosition)
                {
                    Name = "Trawler Rewards"
                };
                rewardChest.modData.Add(REWARD_CHEST_DATA_KEY, "true");

                farm.setObject(rewardChestPosition, rewardChest);
            }

            // Create the trawler object for the beach
            var locationContext = (todayDayOfWeek == Game1.MasterPlayer.modData[MURPHY_DAY_TO_APPEAR_ISLAND] ? GameLocation.LocationContext.Island : GameLocation.LocationContext.Default);

            if (todayDayOfWeek == Game1.MasterPlayer.modData[MURPHY_DAY_TO_APPEAR_ISLAND])
            {
                trawlerObject = new Trawler(island);
            }
            else
            {
                trawlerObject = new Trawler(beach);
            }

            // Create the TrawlerReward class
            _trawlerRewards.Value = new TrawlerRewards(rewardChest);

            // Add the surface location
            TrawlerSurface surfaceLocation = new TrawlerSurface(Path.Combine(ModResources.assetFolderPath, "Maps", "FishingTrawler.tmx"), TRAWLER_SURFACE_LOCATION_NAME)
            {
                IsOutdoors = true, IsFarm = false, locationContext = locationContext
            };

            Game1.locations.Add(surfaceLocation);

            // Add the hull location
            TrawlerHull hullLocation = new TrawlerHull(Path.Combine(ModResources.assetFolderPath, "Maps", "TrawlerHull.tmx"), TRAWLER_HULL_LOCATION_NAME)
            {
                IsOutdoors = false, IsFarm = false, locationContext = locationContext
            };

            Game1.locations.Add(hullLocation);

            // Add the cabin location
            TrawlerCabin cabinLocation = new TrawlerCabin(Path.Combine(ModResources.assetFolderPath, "Maps", "TrawlerCabin.tmx"), TRAWLER_CABIN_LOCATION_NAME)
            {
                IsOutdoors = false, IsFarm = false, locationContext = locationContext
            };

            Game1.locations.Add(cabinLocation);

            // Verify our locations were added and establish our location variables
            _trawlerHull.Value    = Game1.getLocationFromName(TRAWLER_HULL_LOCATION_NAME) as TrawlerHull;
            _trawlerSurface.Value = Game1.getLocationFromName(TRAWLER_SURFACE_LOCATION_NAME) as TrawlerSurface;
            _trawlerCabin.Value   = Game1.getLocationFromName(TRAWLER_CABIN_LOCATION_NAME) as TrawlerCabin;
        }