Ejemplo n.º 1
0
 private void GameLoop_UpdateTicked(object sender, StardewModdingAPI.Events.UpdateTickedEventArgs e)
 {
     if (!Context.IsWorldReady)
     {
         return;
     }
     if (sw.ElapsedMilliseconds >= 1000 * config.Time)
     {
         Ring r  = new Ring();
         int  ID = rand.Next(0, 930);
         Item o  = new Object(ID, config.Stack);
         while (o.Name is "???" or "Error Item" or "Weeds" || o.getDescription() is "..." or "???")
         {
             o = new Object(rand.Next(0, 930), config.Stack);
         }
         if (o.Category == -96 || o.DisplayName.Contains("Ring") || o.DisplayName is "Iridium Band" or "Immunity Band")
         {
             o = new Ring(ID);
         }
         if (Game1.player.freeSpotsInInventory() != 0)
         {
             Game1.player.addItemToInventory(o);
         }
         else
         {
             Game1.player.currentLocation.debris.Add(new Debris(o, Game1.player.getStandingPosition()));
             Monitor.Log($"Added object {o.Name} at {Game1.player.getStandingPosition()}.");
         }
         sw.Restart();
     }
 }
Ejemplo n.º 2
0
 private void GameLoop_UpdateTicked(object sender, StardewModdingAPI.Events.UpdateTickedEventArgs e)
 {
     try
     {
         foreach (Smoke smoke in Smoke.Smokes)
         {
             smoke.Update();
         }
         foreach (Airstrike.Airstrike airstrike in Airstrike.Airstrike.Airstrikes)
         {
             airstrike.Update();
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
        private void GameLoop_UpdateTicked(object sender, StardewModdingAPI.Events.UpdateTickedEventArgs e)
        {
            if (!Context.IsPlayerFree || !Game1.player.swimming || (!(Game1.player.currentLocation is Beach) && !(Game1.player.currentLocation is Forest) && Game1.currentLocation?.Name != "GemIsles"))
            {
                return;
            }

            Point pos = Game1.player.getTileLocationPoint();

            if (Game1.player.position.Y > Game1.viewport.Y + Game1.viewport.Height - 24)
            {
                Game1.player.position.Value = new Vector2(Game1.player.position.X, Game1.viewport.Y + Game1.viewport.Height - 25);
                Monitor.Log("warping south");
                mapY++;
                if (Game1.player.currentLocation is Beach)
                {
                    mapY  = 1;
                    mapX  = 1;
                    pos.X = pos.X * 104 / 128;
                }
                else if (Game1.player.currentLocation is Forest)
                {
                    mapY  = 1;
                    mapX  = 0;
                    pos.X = pos.X * 120 / 128;
                }
                Game1.warpFarmer("GemIsles", pos.X, 0, false);
                return;
            }
            if (Game1.currentLocation.Name != "GemIsles")
            {
                return;
            }
            if (Game1.player.position.Y < Game1.viewport.Y - 8)
            {
                Game1.player.position.Value = new Vector2(Game1.player.position.X, Game1.viewport.Y - 7);
                mapY--;
                Monitor.Log("warping north");
                if (mapY > 0)
                {
                    Game1.warpFarmer("GemIsles", pos.X, 71, false);
                }
                else
                {
                    if (mapX > 0)
                    {
                        pos.X = pos.X * 104 / 128;
                        Game1.warpFarmer("Beach", pos.X, Game1.getLocationFromName("Beach").map.Layers[0].TileHeight - 1, false);
                    }
                    else
                    {
                        pos.X = pos.X * 120 / 128;
                        Game1.warpFarmer("Forest", pos.X, Game1.getLocationFromName("Forest").map.Layers[0].TileHeight - 1, false);
                    }
                }
            }
            else if (Game1.player.position.X > Game1.viewport.X + Game1.viewport.Width - 40)
            {
                Game1.player.position.Value = new Vector2(Game1.viewport.X + Game1.viewport.Width - 41, Game1.player.position.Y);

                mapX++;
                Monitor.Log("warping east");
                Game1.warpFarmer("GemIsles", 0, pos.Y, false);
            }
            else if (Game1.player.position.X < Game1.viewport.X - 24)
            {
                Game1.player.position.Value = new Vector2(Game1.viewport.X - 23, Game1.player.position.Y);
                mapX--;
                Monitor.Log("warping west");
                Game1.warpFarmer("GemIsles", 127, pos.Y, false);
            }
        }