Пример #1
0
 public bool OnMinecartActivation(MinecartInstance mc, GameLocation l, Vector2 vec)
 {
     if (Game1.player.mount != null)
     {
         return(true);
     }
     if (Game1.MasterPlayer.mailReceived.Contains("ccBoilerRoom"))
     {
         if (!Game1.player.isRidingHorse() || Game1.player.mount == null)
         {
             drawMinecartDialogue(mc, l, 0, false);
             return(true);
         }
         Game1.player.mount.checkAction(Game1.player, l);
     }
     else
     {
         Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\Locations:MineCart_OutOfOrder"));
     }
     return(true);
 }
Пример #2
0
 public void WarpFarmer(MinecartInstance mc)
 {
     if (mc.VanillaPassthrough != null)
     {
         //let vanilla handle this one (in case it's been overridden. usually just used for the vanilla carts.)
         Game1.player.currentLocation.answerDialogueAction(mc.VanillaPassthrough, new string[] { });
     }
     else
     {
         //let's handle it ourselves!
         Game1.player.Halt();
         Game1.player.freezePause = 700;
         Game1.warpFarmer(mc.LocationName, mc.LandingPointX, mc.LandingPointY, mc.LandingPointDirection);
         if (mc.IsUnderground)
         {
             if (Game1.getMusicTrackName() == "springtown")
             {
                 Game1.changeMusicTrack("none");
             }
         }
     }
 }
Пример #3
0
 public bool onDialogueSelect(MinecartInstance src, string key)
 {
     if (key == "Cancel")
     {
         return(true);
     }
     if (key == "MCP.PaginationMinus")
     {
         bool fp      = false;
         int  pageNum = Math.Max(0, LastPage - 1);
         if (pageNum == PageCount - 1)
         {
             fp = true;
         }
         drawMinecartDialogue(src, Game1.player.currentLocation, pageNum, fp);
         return(true);
     }
     if (key == "MCP.PaginationPlus")
     {
         bool fp      = false;
         int  pageNum = Math.Min(PageCount - 1, LastPage + 1);
         if (pageNum == PageCount - 1)
         {
             fp = true;
         }
         drawMinecartDialogue(src, Game1.player.currentLocation, pageNum, fp);
         return(true);
     }
     if (!Minecarts.ContainsKey(key))
     {
         return(true);
     }
     //Monitor.Log("Minecart key: " + key, LogLevel.Alert);
     WarpFarmer(Minecarts[key]);
     return(true);
 }
Пример #4
0
        public void drawMinecartDialogue(MinecartInstance src, GameLocation l, int page, bool finalPage)
        {
            LoadData();
            List <Response> responses = new List <Response>();

            if (page > 0)
            {
                responses.Add(new Response("MCP.PaginationMinus", "@ Previous Page"));
            }
            int counter    = 0;
            int startCount = (page * 4) + 2;

            if (page == 0)
            {
                startCount -= 2;
            }
            int endCount = ((page + 1) * 4) + 1;

            if (finalPage)
            {
                endCount++;
            }
            foreach (var mc in Minecarts.OrderBy(x => x.Value.DisplayName))
            {
                if (mc.Value.NetworkId != src.NetworkId)
                {
                    continue;
                }
                if (mc.Value.LocationName == l.Name)
                {
                    if (RawDistance(mc.Value.LandingPointX, mc.Value.LandingPointY, Game1.player.getTileX(), Game1.player.getTileY()) < 6)
                    {
                        continue;
                    }
                }
                if (Game1.getLocationFromName(mc.Value.LocationName) == null)
                {
                    continue;
                }
                if (mc.Value.MailCondition != null && !Game1.MasterPlayer.mailReceived.Contains(mc.Value.MailCondition))
                {
                    continue;
                }
                counter += 1;
                if (counter >= startCount && counter <= endCount)
                {
                    responses.Add(new Response(mc.Key, mc.Value.DisplayName));
                }
            }
            PageCount = counter / 5;
            if (counter % 5 > 0)
            {
                PageCount += 1;
            }
            if (page < PageCount - 1)
            {
                responses.Add(new Response("MCP.PaginationPlus", "Next Page >"));
            }
            responses.Add(new Response("Cancel", Game1.content.LoadString("Strings\\Locations:MineCart_Destination_Cancel")));
            LastPage = page;
            Game1.activeClickableMenu = new DialogueBox(src, this, responses);
            Game1.dialogueUp          = true;
            Game1.player.CanMove      = false;
        }
Пример #5
0
 public DialogueBox(MinecartInstance mc, ModEntry mod, List <Response> responses) : base(Game1.content.LoadString("Strings\\Locations:MineCart_ChooseDestination"), responses)
 {
     activeCart = mc;
     Mod        = mod;
     tryOutro   = typeof(StardewValley.Menus.DialogueBox).GetMethod("tryOutro", BindingFlags.NonPublic | BindingFlags.Instance);
 }