예제 #1
0
        /// <summary>The mod entry point, called after the mod is first loaded</summary>
        /// <param name="helper">Provides simplified APIs for writing mods</param>
        public override void Entry(IModHelper helper)
        {
            ImageBuilder.CleanUpReplacementFiles();

            _helper        = helper;
            Globals.ModRef = this;
            Globals.Config = Helper.ReadConfig <ModConfig>();

            this._modAssetLoader = new AssetLoader(this);
            this._modAssetEditor = new AssetEditor(this);
            helper.Content.AssetLoaders.Add(this._modAssetLoader);
            helper.Content.AssetEditors.Add(this._modAssetEditor);

            this.PreLoadReplacments();
            helper.Events.GameLoop.SaveLoaded             += (sender, args) => this.CalculateAllReplacements();
            helper.Events.Multiplayer.PeerContextReceived += (sender, args) => FixParsnipSeedBox();

            helper.Events.Display.RenderingActiveMenu += (sender, args) => _modAssetLoader.TryReplaceTitleScreen();
            helper.Events.Display.MenuChanged         += BundleMenuAdjustments.FixRingSelection;
            helper.Events.Display.RenderingActiveMenu += (sender, args) => BundleMenuAdjustments.FixRingDeposits();
            helper.Events.GameLoop.ReturnedToTitle    += (sender, args) => _modAssetLoader.ReplaceTitleScreenAfterReturning();
            helper.Events.GameLoop.ReturnedToTitle    += (sender, args) => ImageBuilder.CleanUpReplacementFiles();

            if (Globals.Config.RandomizeMusic)
            {
                helper.Events.GameLoop.UpdateTicked += (sender, args) => this.TryReplaceSong();
            }
            if (Globals.Config.RandomizeRain)
            {
                helper.Events.GameLoop.DayEnding += _modAssetLoader.ReplaceRain;
            }
            if (Globals.Config.RandomizeCrops || Globals.Config.RandomizeFish)
            {
                helper.Events.Display.RenderingActiveMenu += (sender, args) => CraftingRecipeAdjustments.HandleCraftingMenus();
            }

            helper.Events.GameLoop.DayStarted += (sender, args) => UseOverriddenSubmarine();
            helper.Events.GameLoop.DayEnding  += (sender, args) => RestoreSubmarineLocation();
        }
        public void CalculateEdits()
        {
            ItemList.Initialize();
            ValidateItemList();

            EditedObjectInformation editedObjectInfo = new EditedObjectInformation();

            FishRandomizer.Randomize(editedObjectInfo);
            _fishReplacements = editedObjectInfo.FishReplacements;

            CropRandomizer.Randomize(editedObjectInfo);
            _fruitTreeReplacements         = editedObjectInfo.FruitTreeReplacements;
            _cropReplacements              = editedObjectInfo.CropsReplacements;
            _objectInformationReplacements = editedObjectInfo.ObjectInformationReplacements;

            _blueprintReplacements      = BlueprintRandomizer.Randomize();
            _monsterReplacements        = MonsterRandomizer.Randomize();      // Must be done before recipes since rarities of drops change
            _locationsReplacements      = LocationRandomizer.Randomize();     // Must be done before recipes because of wild seeds
            _recipeReplacements         = CraftingRecipeRandomizer.Randomize();
            _stringReplacements         = StringsAdjustments.GetCSFileStringReplacements();
            _locationStringReplacements = StringsAdjustments.GetLocationStringReplacements();
            _bundleReplacements         = BundleRandomizer.Randomize();
            MusicReplacements           = MusicRandomizer.Randomize();

            QuestInformation questInfo = QuestRandomizer.Randomize();

            _questReplacements = questInfo.QuestReplacements;
            _mailReplacements  = questInfo.MailReplacements;

            CraftingRecipeAdjustments.FixCookingRecipeDisplayNames();
            _cookingChannelReplacements = CookingChannel.GetTextEdits();

            _weaponReplacements   = WeaponRandomizer.Randomize();
            _bootReplacements     = BootRandomizer.Randomize();
            _birthdayReplacements = BirthdayRandomizer.Randomize();
        }
예제 #3
0
        /// <summary>The mod entry point, called after the mod is first loaded</summary>
        /// <param name="helper">Provides simplified APIs for writing mods</param>
        public override void Entry(IModHelper helper)
        {
            ImageBuilder.CleanUpReplacementFiles();

            _helper        = helper;
            Globals.ModRef = this;
            Globals.Config = Helper.ReadConfig <ModConfig>();

            this._modAssetLoader = new AssetLoader(this);
            this._modAssetEditor = new AssetEditor(this);
            helper.Content.AssetLoaders.Add(this._modAssetLoader);
            helper.Content.AssetEditors.Add(this._modAssetEditor);

            this.PreLoadReplacments();
            helper.Events.GameLoop.SaveLoaded         += (sender, args) => this.CalculateAllReplacements();
            helper.Events.Display.RenderingActiveMenu += (sender, args) => _modAssetLoader.TryReplaceTitleScreen();
            helper.Events.GameLoop.ReturnedToTitle    += (sender, args) => _modAssetLoader.ReplaceTitleScreenAfterReturning();

            if (Globals.Config.RandomizeMusic)
            {
                helper.Events.GameLoop.UpdateTicked += (sender, args) => this.TryReplaceSong();
            }
            if (Globals.Config.RandomizeRain)
            {
                helper.Events.GameLoop.DayEnding += _modAssetLoader.ReplaceRain;
            }

            if (Globals.Config.Crops.Randomize)
            {
                helper.Events.Multiplayer.PeerContextReceived += (sender, args) => FixParsnipSeedBox();
            }

            if (Globals.Config.Crops.Randomize || Globals.Config.Fish.Randomize)
            {
                helper.Events.Display.RenderingActiveMenu += (sender, args) => CraftingRecipeAdjustments.HandleCraftingMenus();

                // Fix for the Special Orders causing crashes
                // Re-instate the object info when the save is first loaded for the session, and when saving so that the
                // items have the correct names on the items sold summary screen
                helper.Events.GameLoop.DayEnding  += (sender, args) => _modAssetEditor.UndoObjectInformationReplacements();
                helper.Events.GameLoop.SaveLoaded += (sender, args) => _modAssetEditor.RedoObjectInformationReplacements();
                helper.Events.GameLoop.Saving     += (sender, args) => _modAssetEditor.RedoObjectInformationReplacements();
            }

            if (Globals.Config.RandomizeForagables)
            {
                helper.Events.GameLoop.GameLaunched += (sender, args) => WildSeedAdjustments.ReplaceGetRandomWildCropForSeason();
            }

            if (Globals.Config.Fish.Randomize)
            {
                helper.Events.GameLoop.DayStarted += (sender, args) => OverriddenSubmarine.UseOverriddenSubmarine();
                helper.Events.GameLoop.DayEnding  += (sender, args) => OverriddenSubmarine.RestoreSubmarineLocation();
            }

            if (Globals.Config.Bundles.Randomize)
            {
                helper.Events.Display.MenuChanged         += BundleMenuAdjustments.FixRingSelection;
                helper.Events.Display.RenderingActiveMenu += (sender, args) => BundleMenuAdjustments.FixRingDeposits();

                if (Globals.Config.Bundles.ShowDescriptionsInBundleTooltips)
                {
                    helper.Events.Display.RenderedActiveMenu += (sender, args) => BundleMenuAdjustments.AddDescriptionsToBundleTooltips();
                }
            }
        }