Exemplo n.º 1
0
 public static bool Prefix(LocationRequest locationRequest, int tileX, int tileY, int facingDirectionAfterWarp)
 {
     if (locationRequest.Name.Equals("CABIN_ERROR"))
     {
         Logger.Log("Player attempted to warp the a Cabin, but encountered an error!", StardewModdingAPI.LogLevel.Error);
         return(false);
     }
     else if (locationRequest.Name.StartsWith("Cabin"))
     {
         Logger.Log("Player warping to Cabin.  Destination: " + locationRequest.ToString() + ", {" + tileX + ", " + tileY + "}");
     }
     return(true);
 }
Exemplo n.º 2
0
        public static bool Prefix(string locationName, bool isStructure, ref LocationRequest __result)
        {
            if (locationName.ToLower().Equals("here"))
            {
                string name = Game1.currentLocation.isStructure ? Game1.currentLocation.uniqueName : Game1.currentLocation.name;
                __result = new LocationRequest(name, Game1.currentLocation.isStructure, Game1.currentLocation);
                Logger.Log("Location request: " + __result.ToString());
                return(false);
            }
            if (locationName.Equals("Cabin") && !(Game1.currentLocation is Cabin))
            {
                Logger.Log("Parsing vague destination 'Cabin' as Cabin_0");
                locationName = "Cabin_0";
            }
            if (locationName.Split('_').Length > 1 && locationName.StartsWith("Cabin"))
            {
                Logger.Log("Warping to cabin...");

                List <Cabin> allCabins = getCabins(Game1.getFarm());
                if (allCabins.Count < 1)
                {
                    Logger.Log("No cabins found!");
                    __result = new LocationRequest("CABIN_ERROR", false, null);
                    return(false);
                }

                string identifier = locationName.Split('_')[1].ToLower();

                Cabin resultCabin = getCabinForID(identifier, allCabins);

                if (resultCabin != null)
                {
                    Logger.Log("Warping to cabin...");
                    __result = new LocationRequest("Cabin", true, resultCabin);
                    return(false);
                }
                Logger.Log("Cabin was null, using default code instead.");
            }
            return(true);
        }