예제 #1
0
        /// <summary>Tell the dummies how to use the console command.</summary>
        private string GetCommandUsage()
        {
            string result = "\n\nUsage: player_upgradetools < level >\n - level: one of 'copper', 'steel', 'gold', 'iridium'";

            if (ModRegistry.IsLoaded("stokastic.PrismaticTools"))
            {
                result += ", 'prismatic'";
            }
            else if (ModRegistry.IsLoaded("kakashigr.RadioactiveTools"))
            {
                result += ", 'radioactive'";
            }

            return(result);
        }
예제 #2
0
        /// <summary> Looks for animals left thirsty, notifies player of them and loads new tilesheets if needed. </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void HandleDayUpdate(object sender, SavedEventArgs e)
        {
            LoadNewTileSheets();

            // Notify player of animals left thirsty, if any.
            if (AnimalsLeftThirstyYesterday.Any())
            {
                switch (AnimalsLeftThirstyYesterday.Count)
                {
                case 1 when Helper.ModRegistry.IsLoaded("Paritee.GenderNeutralFarmAnimals"):
                    Game1.showGlobalMessage(ModHelper.Translation.Get(
                                                "AnimalsLeftWithoutWaterYesterday.globalMessage.oneAnimal_UnknownGender",
                                                new { firstAnimalName = AnimalsLeftThirstyYesterday[0].displayName }));

                    break;

                case 1 when AnimalsLeftThirstyYesterday[0].isMale():
        /// <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)
        {
            // get unique id and generate buff ids
            UniqueID = ModManifest.UniqueID;
            var uniqueHash = (int)(Math.Abs(UniqueID.GetHashCode()) / Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(UniqueID.GetHashCode()))) - 8 + 1));

            Utility.SetProfessionBuffIDs(uniqueHash);

            // get mod helpers
            Content     = helper.Content;
            Events      = helper.Events;
            ModRegistry = helper.ModRegistry;
            Reflection  = helper.Reflection;
            I18n        = helper.Translation;

            // get configs.json
            Config = helper.ReadConfig <ProfessionsConfig>();

            // patch profession icons
            if (Config.UseModdedProfessionIcons)
            {
                helper.Content.AssetEditors.Add(new IconEditor());
            }

            // apply patches
            BasePatch.Init(Monitor);
            new HarmonyPatcher().ApplyAll(
                new AnimalHouseAddNewHatchedAnimalPatch(),
                new BasicProjectileBehaviorOnCollisionWithMonsterPatch(),
                new BasicProjectileCtorPatch(),
                new BobberBarCtorPatch(),
                new BushShakePatch(),
                new CrabPotCheckForActionPatch(),
                new CrabPotDayUpdatePatch(),
                new CrabPotDrawPatch(),
                new CrabPotPerformObjectDropInActionPatch(),
                new CraftingRecipeCtorPatch(),
                new CropHarvestPatch(),
                new FarmAnimalDayUpdatePatch(),
                new FarmAnimalGetSellPricePatch(),
                new FarmAnimalPetPatch(),
                new FarmerHasOrWillReceiveMailPatch(),
                new FarmerShowItemIntakePatch(),
                new FarmerTakeDamagePatch(),
                new FishingRodStartMinigameEndFunctionPatch(),
                new FishPondUpdateMaximumOccupancyPatch(),
                new FruitTreeDayUpdatePatch(),
                new Game1CreateObjectDebrisPatch(),
                new Game1DrawHUDPatch(),
                new GameLocationBreakStonePatch(),
                new GameLocationCheckActionPatch(),
                new GameLocationDamageMonsterPatch(),
                new GameLocationGetFishPatch(),
                new GameLocationExplodePatch(),
                new GameLocationOnStoneDestroyedPatch(),
                new GeodeMenuUpdatePatch(),
                new GreenSlimeOnDealContactDamagePatch(),
                new GreenSlimeUpdatePatch(),
                new LevelUpMenuAddProfessionDescriptionsPatch(),
                new LevelUpMenuGetImmediateProfessionPerkPatch(),
                new LevelUpMenuGetProfessionNamePatch(),
                new LevelUpMenuGetProfessionTitleFromNumberPatch(),
                new LevelUpMenuRemoveImmediateProfessionPerkPatch(),
                new LevelUpMenuRevalidateHealthPatch(),
                new MeleeWeaponDoAnimateSpecialMovePatch(),
                new MineShaftCheckStoneForItemsPatch(),
                new ObjectCheckForActionPatch(),
                new ObjectCtorPatch(),
                new ObjectGetMinutesForCrystalariumPatch(),
                new ObjectGetPriceAfterMultipliersPatch(),
                new ObjectPerformObjectDropInActionPatch(),
                new PondQueryMenuDrawPatch(),
                new ProjectileBehaviorOnCollisionPatch(),
                new QuestionEventSetUpPatch(),
                new SlingshotPerformFirePatch(),
                new TemporaryAnimatedSpriteCtorPatch(),
                new TreeDayUpdatePatch(),
                new TreeUpdateTapperProductPatch(),
                ModRegistry.IsLoaded("Pathoschild.Automate") ? new CrabPotMachineGetStatePatch() : null
                );

            // start event manager
            EventManager = new EventManager(Monitor);

            // add debug commands
            Helper.ConsoleCommands.Add("player_addprofessions", "Add the specified professions to the local player." + _GetCommandUsage(), _AddProfessionsToLocalPlayer);
            Helper.ConsoleCommands.Add("player_resetprofessions", "Reset all skills and professions for the local player.", _ResetLocalPlayerProfessions);
            Helper.ConsoleCommands.Add("player_checkdatafield", "Check current value for a profession data field." + _GetAvailableDataFields(), _PrintDataField);
            Helper.ConsoleCommands.Add("wol_checksubscribed", "List currently subscribed mod events.", _PrintSubscribedEvents);
        }