Example #1
0
        internal override WarpLocation GetWarpLocation()
        {
            WarpLocation newLocation = null;

            switch (this.parentSheetIndex)
            {
            case 688:
                newLocation = WarpLocations.FarmWarpLocation_Totem;
                break;

            case 689:
                newLocation = WarpLocations.MountainWarpLocation_Totem;
                break;

            case 690:
                newLocation = WarpLocations.BeachWarpLocation_Totem;
                break;

            case 261:
                newLocation = WarpLocations.DesertWarpLocation_Totem;
                break;
            }

            return(newLocation);
        }
Example #2
0
        internal void DoWarp()
        {
            WarpLocation location = this.GetWarpLocation();

            Game1.warpFarmer(location.locationName, location.xCoord, location.yCoord, false);
            this.AfterWarp();
        }
        public static void ShowWarpMenu(string exclude = "", bool consume = false)
        {
            if (!ModEntry.config.MenuEnabled)
            {
                ShowFailureText();
                ModEntry.monitor.Log("Warp menu is disabled in config, menu not displayed.");
                return;
            }

            List <WarpLocation> dests = new();
            Dictionary <string, WarpLocation> locs = Utils.GetWarpLocations();

            if (locs.ContainsKey(exclude))
            {
                if (!locs[exclude].Enabled && !ModEntry.config.AccessFromDisabled)
                {
                    ShowFailureText();
                    ModEntry.monitor.Log("Access from locked locations is disabled, menu not displayed.");
                    return;
                }
            }
            string normalized = exclude.ToLower();

            foreach (string id in locs.Keys)
            {
                WarpLocation loc    = locs[id];
                string       normid = id.ToLower();
                if (
                    !loc.AlwaysHide && (
                        normalized == "_force" ||
                        (loc.Enabled && normid != normalized) ||
                        (normid == "farm" && normalized == "_wand")
                        )
                    )
                {
                    if (loc is CustomWarpLocation || Game1.getLocationFromName(loc.Location) != null)
                    {
                        dests.Add(locs[id]);
                    }
                    else
                    {
                        ModEntry.monitor.Log("Invalid Location name '" + loc.Location + "'; skipping entry.", LogLevel.Warn);
                    }
                }
            }
            if (dests.Count == 0)
            {
                ModEntry.monitor.Log("No valid warp destinations, menu not displayed.");
                ShowFailureText();
                return;
            }
            Item stack = consume ? Game1.player.CurrentItem : null;

            Game1.activeClickableMenu = new WarpMenu(dests, (WarpLocation where) =>
            {
                WarpToLocation(where, normalized == "_wand");
                Utils.reduceItemCount(Game1.player, stack, 1);
            });
        }
        public static bool DirectWarp(string location, bool force)
        {
            if (location is null)
            {
                ModEntry.monitor.Log("Destination is null! Cannot warp!", LogLevel.Error);
                ShowFailureText();
                return(false);
            }
            Dictionary <String, WarpLocation> locs = Utils.GetWarpLocations();
            WarpLocation loc = locs[location];

            if (locs.ContainsKey(location))
            {
                if (!(Game1.getLocationFromName(loc.Location) is null))
                {
                    if (!Utils.IsFestivalAtLocation(loc.Location) || Utils.IsFestivalReady())
                    {
                        if (force || loc.Enabled)
                        {
                            WarpToLocation(loc);
                            return(true);
                        }
                        else
                        {
                            ShowFailureText();
                            return(false);
                        }
                    }
                    else
                    {
                        ModEntry.monitor.Log("Failed to warp to '" + loc.Location + "': Festival at location not ready.", LogLevel.Debug);
                        ShowFailureText();
                        return(false);
                    }
                }
                else
                {
                    ModEntry.monitor.Log("Failed to warp to '" + loc.Location + "': Location with that name does not exist!", LogLevel.Error);
                    ShowFailureText();
                    return(false);
                }
            }
Example #5
0
 private void Warp(WarpLocation location)
 {
     StartCoroutine(SwitchScene(location.Scene, currentScene, location.Position));
 }
Example #6
0
 public void Execute(WarpLocation targetLocation)
 {
     warpRequest.Invoke(targetLocation);
 }
Example #7
0
 private void OnWarpEvent(WarpLocation warpEvent)
 {
     Dispatch(warpEvent.Position);
 }