Exemplo n.º 1
0
        public static void DeepWoodsInitServerAnswerReceived(string[] deepWoodsLevelNames)
        {
            if (Game1.IsMasterGame)
            {
                return;
            }

            ModEntry.Log("DeepWoodsInitServerAnswerReceived", StardewModdingAPI.LogLevel.Trace);

            DeepWoodsManager.AddAll(deepWoodsLevelNames);
            EasterEggFunctions.RestoreAllEasterEggsInGame();
            // WoodsObelisk.RestoreAllInGame(); <- Not needed, server already sends correct building
            mod.isDeepWoodsGameRunning = true;
        }
Exemplo n.º 2
0
        private void OnDayStarted(object sender, DayStartedEventArgs args)
        {
            ModEntry.Log("TimeEvents_AfterDayStarted", StardewModdingAPI.LogLevel.Trace);

            InitGameIfNecessary();

            if (!isDeepWoodsGameRunning)
            {
                return;
            }

            DeepWoodsManager.LocalDayUpdate(Game1.dayOfMonth);
            EasterEggFunctions.InterceptIncubatorEggs();
        }
Exemplo n.º 3
0
        private void SaveEvents_AfterSave(object sender, EventArgs args)
        {
            ModEntry.Log("SaveEvents_AfterSave", StardewModdingAPI.LogLevel.Trace);

            isBeforeSaveCount--;

            if (isBeforeSaveCount > 0)
            {
                ModEntry.Log("AfterSave event was called before save has finished. Ignoring.", StardewModdingAPI.LogLevel.Warn);
                return;
            }

            if (isBeforeSaveCount < 0)
            {
                ModEntry.Log("AfterSave event was called without previous BeforeSave call. Mod is now in unknown state, all hell might break lose.", StardewModdingAPI.LogLevel.Error);
                return;
            }

            DeepWoodsManager.Restore();
            EasterEggFunctions.RestoreAllEasterEggsInGame();
            WoodsObelisk.RestoreAllInGame();
        }
Exemplo n.º 4
0
        private void InitGameIfNecessary()
        {
            ModEntry.Log("InitGameIfNecessary(" + isDeepWoodsGameRunning + ")", StardewModdingAPI.LogLevel.Trace);

            if (isDeepWoodsGameRunning)
            {
                return;
            }

            if (Game1.IsMasterGame)
            {
                DeepWoodsSettings.DoLoad();
                DeepWoodsManager.Add();
                EasterEggFunctions.RestoreAllEasterEggsInGame();
                WoodsObelisk.RestoreAllInGame();
                isDeepWoodsGameRunning = true;
            }
            else
            {
                DeepWoodsManager.Remove();
                ModEntry.SendMessage(MessageId.RequestMetadata, Game1.MasterPlayer.UniqueMultiplayerID);
            }
        }
Exemplo n.º 5
0
        private void PlayerWarped(Farmer who, GameLocation prevLocation, GameLocation newLocation)
        {
            if (!isDeepWoodsGameRunning)
            {
                return;
            }

            if (prevLocation is DeepWoods dw1 && newLocation is DeepWoods dw2 && dw1.Name == dw2.Name)
            {
                return;
            }

            if (newLocation is Woods woods)
            {
                OpenPassageInSecretWoods(woods);
            }

            DeepWoodsManager.PlayerWarped(who, prevLocation as DeepWoods, newLocation as DeepWoods, newLocation);

            if (newLocation is AnimalHouse animalHouse)
            {
                EasterEggFunctions.CheckEggHatched(who, animalHouse);
            }
        }