Exemplo n.º 1
0
    private void RemoveSkipPoints()
    {
        int counter = 0;

        for (int i = 0; i < allPoints.Length; i++)
        {
            if (allPoints[i].IsScriptCompleted())
            {
                allPoints[i] = null;
            }
            else
            {
                counter++;
            }
        }

        SpaceEvents[] newAllPoints = new SpaceEvents[counter];

        int currentNewIndex = 0;

        for (int i = 0; i < allPoints.Length; i++)
        {
            if (allPoints[i] != null)
            {
                newAllPoints[currentNewIndex] = allPoints[i];
                currentNewIndex++;
            }
        }
        allPoints = newAllPoints;
    }
Exemplo n.º 2
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call before <see cref="Game1.eventFinished"/>.</summary>
 private static void Before_EventFinished()
 {
     if (Game1.CurrentEvent != null)
     {
         SpaceEvents.InvokeOnEventFinished();
     }
 }
Exemplo n.º 3
0
 public static void Postfix(Farmer __instance)
 {
     if (__instance.itemToEat == null)
     {
         return;
     }
     SpaceEvents.InvokeOnItemEaten(__instance);
 }
Exemplo n.º 4
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call after <see cref="Farmer.doneEating"/>.</summary>
 public static void After_DoneEating(Farmer __instance)
 {
     if (__instance.itemToEat == null)
     {
         return;
     }
     SpaceEvents.InvokeOnItemEaten(__instance);
 }
Exemplo n.º 5
0
        public static bool Prefix(Event __instance, Location tileLocation, xTile.Dimensions.Rectangle viewport, Farmer who)
        {
            var actionStr = Game1.currentLocation.doesTileHaveProperty(tileLocation.X, tileLocation.Y, "Action", "Buildings");

            if (actionStr != null)
            {
                return(!SpaceEvents.InvokeActionActivated(who, actionStr, tileLocation));
            }
            return(true);
        }
Exemplo n.º 6
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call before <see cref="NPC.receiveGift"/>.</summary>
 /// <returns>Returns whether to run the original method.</returns>
 private static bool Before_ReceiveGift(NPC __instance, SObject o, Farmer giver, bool updateGiftLimitInfo, float friendshipChangeMultiplier, bool showResponse)
 {
     if (o is CustomObject customObj)
     {
         NpcPatcher.DoReceiveGift(__instance, customObj, giver, updateGiftLimitInfo, friendshipChangeMultiplier, showResponse);
         SpaceEvents.InvokeAfterGiftGiven(__instance, o, giver);
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
 private void onUpdate(object sender, EventArgs args)
 {
     if (Game1.currentLoader != null)
     {
         if (Game1.currentLoader.Current == 25 && prevLoaderNum != 25)
         {
             SpaceEvents.InvokeOnBlankSave();
         }
         prevLoaderNum = Game1.currentLoader.Current;
     }
     //Log.debug("L:" + (Game1.currentLoader != null ? Game1.currentLoader.Current:-1));
 }
Exemplo n.º 8
0
 private void OrganizeAllPoints()
 {
     for (int i = 0; i < allPoints.Length; i++)
     {
         if (!allPoints[i].name.Equals(orderOfEvents[i]))  //if it does not equal
         {
             int         index = GetIndexOfToStringInAllPoints(orderOfEvents[i], i);
             SpaceEvents temp  = allPoints[i];
             allPoints[i]     = allPoints[index];
             allPoints[index] = temp;
         }
     }
 }
Exemplo n.º 9
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call before <see cref="GameServer.sendServerIntroduction"/>.</summary>
 private static void After_SendServerIntroduction(GameServer __instance, long peer)
 {
     SpaceEvents.InvokeServerGotClient(__instance, peer);
 }
Exemplo n.º 10
0
 public static bool Prefix(NPC __instance, Farmer who)
 {
     return(!SpaceEvents.InvokeBeforeReceiveObject(__instance, who.ActiveObject, who));
 }
Exemplo n.º 11
0
 public static void Postfix(ref FarmEvent __result)
 {
     SpaceEvents.InvokeChooseNightlyFarmEvent(__result);
 }
Exemplo n.º 12
0
 public static void Postfix(GameServer __instance, long peer)
 {
     SpaceEvents.InvokeServerGotClient(__instance, peer);
 }
Exemplo n.º 13
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call after <see cref="Utility.pickFarmEvent"/>.</summary>
 private static void After_PickFarmEvent(ref FarmEvent __result)
 {
     __result = SpaceEvents.InvokeChooseNightlyFarmEvent(__result);
 }
Exemplo n.º 14
0
 public static void Postfix(GameLocation __instance, Vector2 tileLocation, int radius, Farmer who)
 {
     SpaceEvents.InvokeBombExploded(who, tileLocation, radius);
 }
Exemplo n.º 15
0
 /// <summary>The method to call before <see cref="Game1.warpFarmer(LocationRequest,int,int,int)"/>.</summary>
 private static bool Before_WarpFarmer(ref LocationRequest locationRequest, ref int tileX, ref int tileY, ref int facingDirectionAfterWarp)
 {
     return(!SpaceEvents.InvokeBeforeWarp(ref locationRequest, ref tileX, ref tileY, ref facingDirectionAfterWarp));
 }
Exemplo n.º 16
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call before <see cref="NPC.tryToReceiveActiveObject"/>.</summary>
 private static bool Before_TryToReceiveActiveObject(NPC __instance, Farmer who)
 {
     return(!SpaceEvents.InvokeBeforeReceiveObject(__instance, who.ActiveObject, who));
 }
Exemplo n.º 17
0
 /// <summary>The method to call after <see cref="NPC.receiveGift"/>.</summary>
 private static void After_ReceiveGift(NPC __instance, SObject o, Farmer giver, bool updateGiftLimitInfo = true, float friendshipChangeMultiplier = 1f, bool showResponse = true)
 {
     SpaceEvents.InvokeAfterGiftGiven(__instance, o, giver);
 }
Exemplo n.º 18
0
        public static FarmEvent pickFarmEvent()
        {
            FarmEvent ret = null;

            {
                Random random = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2);
                if (Game1.weddingToday)
                {
                    ret = (FarmEvent)null;
                }
                else if ((int)Game1.stats.DaysPlayed == 31)
                {
                    ret = (FarmEvent) new SoundInTheNightEvent(4);
                }
                else if (Game1.player.mailForTomorrow.Contains("jojaPantry%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaPantry"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(0);
                }
                else if (Game1.player.mailForTomorrow.Contains("ccPantry%&NL&%") || Game1.player.mailForTomorrow.Contains("ccPantry"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(1);
                }
                else if (Game1.player.mailForTomorrow.Contains("jojaVault%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaVault"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(6);
                }
                else if (Game1.player.mailForTomorrow.Contains("ccVault%&NL&%") || Game1.player.mailForTomorrow.Contains("ccVault"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(7);
                }
                else if (Game1.player.mailForTomorrow.Contains("jojaBoilerRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaBoilerRoom"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(2);
                }
                else if (Game1.player.mailForTomorrow.Contains("ccBoilerRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("ccBoilerRoom"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(3);
                }
                else if (Game1.player.mailForTomorrow.Contains("jojaCraftsRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaCraftsRoom"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(4);
                }
                else if (Game1.player.mailForTomorrow.Contains("ccCraftsRoom%&NL&%") || Game1.player.mailForTomorrow.Contains("ccCraftsRoom"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(5);
                }
                else if (Game1.player.mailForTomorrow.Contains("jojaFishTank%&NL&%") || Game1.player.mailForTomorrow.Contains("jojaFishTank"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(8);
                }
                else if (Game1.player.mailForTomorrow.Contains("ccFishTank%&NL&%") || Game1.player.mailForTomorrow.Contains("ccFishTank"))
                {
                    ret = (FarmEvent) new WorldChangeEvent(9);
                }
                else if (Game1.player.isMarried() && Game1.player.spouse != null && Game1.getCharacterFromName(Game1.player.spouse, false).daysUntilBirthing == 0)
                {
                    ret = (FarmEvent) new BirthingEvent();
                }
                else if (Game1.player.isMarried() && Game1.player.spouse != null && (Game1.getCharacterFromName(Game1.player.spouse, false).canGetPregnant() && random.NextDouble() < 0.05))
                {
                    ret = (FarmEvent) new QuestionEvent(1);
                }
                else if (random.NextDouble() < 0.01 && !Game1.currentSeason.Equals("winter"))
                {
                    ret = (FarmEvent) new FairyEvent();
                }
                else if (random.NextDouble() < 0.01)
                {
                    ret = (FarmEvent) new WitchEvent();
                }
                else if (random.NextDouble() < 0.01)
                {
                    ret = (FarmEvent) new SoundInTheNightEvent(1);
                }
                else if (random.NextDouble() < 0.01 && Game1.year > 1)
                {
                    ret = (FarmEvent) new SoundInTheNightEvent(0);
                }
                else if (random.NextDouble() < 0.01)
                {
                    ret = (FarmEvent) new SoundInTheNightEvent(3);
                }
                else if (random.NextDouble() < 0.5)
                {
                    ret = (FarmEvent) new QuestionEvent(2);
                }
                else
                {
                    ret = (FarmEvent) new SoundInTheNightEvent(2);
                }
            }

            return(SpaceEvents.InvokeChooseNightlyFarmEvent(ret));
        }
 /*********
 ** Private methods
 *********/
 /// <summary>The method to call before <see cref="GameLocation.performAction"/>.</summary>
 private static bool Before_PerformAction(GameLocation __instance, string action, Farmer who, Location tileLocation)
 {
     return(!SpaceEvents.InvokeActionActivated(who, action, tileLocation));
 }
Exemplo n.º 20
0
 public static void Postfix(NPC __instance, StardewValley.Object o, Farmer giver, bool updateGiftLimitInfo = true, float friendshipChangeMultiplier = 1f, bool showResponse = true)
 {
     SpaceEvents.InvokeAfterGiftGiven(__instance, o, giver);
 }
Exemplo n.º 21
0
 public static bool Prefix(GameLocation __instance, string action, Farmer who, Location tileLocation)
 {
     return(!SpaceEvents.InvokeActionActivated(who, action, tileLocation));
 }
Exemplo n.º 22
0
 public static void Postfix()
 {
     SpaceEvents.InvokeOnItemEaten();
 }
Exemplo n.º 23
0
 public static bool Prefix(GameLocation __instance, string fullActionString, Vector2 playerStandingPosition)
 {
     return(!SpaceEvents.InvokeTouchActionActivated(Game1.player, fullActionString, new Location(0, 0)));
 }
Exemplo n.º 24
0
        public static void showEndOfNightStuff_mid()
        {
            var ev = new EventArgsShowNightEndMenus();

            SpaceEvents.InvokeShowNightEndMenus(ev);
        }
Exemplo n.º 25
0
        private static void ShowEndOfNightStuffLogic()
        {
            var ev = new EventArgsShowNightEndMenus();

            SpaceEvents.InvokeShowNightEndMenus(ev);
        }
Exemplo n.º 26
0
 public static void Postfix(Farmer __instance)
 {
     SpaceEvents.InvokeOnItemEaten(__instance);
 }
Exemplo n.º 27
0
 /// <summary>The method to call after <see cref="Game1.loadForNewGame"/>.</summary>
 private static void After_LoadForNewGame(bool loadedGame)
 {
     SpaceEvents.InvokeOnBlankSave();
 }
Exemplo n.º 28
0
 public static bool Prefix(ref LocationRequest locationRequest, int tileX, int tileY, int facingDirectionAfterWarp)
 {
     return(!SpaceEvents.InvokeBeforeWarp(ref locationRequest, tileX, tileY, facingDirectionAfterWarp));
 }
Exemplo n.º 29
0
 public static void Postfix(bool loadedGame)
 {
     SpaceEvents.InvokeOnBlankSave();
 }
 /// <summary>The method to call after <see cref="GameLocation.explode"/>.</summary>
 private static void After_Explode(GameLocation __instance, Vector2 tileLocation, int radius, Farmer who)
 {
     SpaceEvents.InvokeBombExploded(who, tileLocation, radius);
 }