Ejemplo n.º 1
0
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // Hook into the APIs we utilize
            if (Helper.ModRegistry.IsLoaded("Omegasis.SaveAnywhere") && ApiManager.HookIntoSaveAnywhere(Helper))
            {
                _saveAnywhereApi = ApiManager.GetSaveAnywhereApi();

                // Hook into save related events
                _saveAnywhereApi.BeforeSave += this.OnSaving;
                _saveAnywhereApi.AfterSave  += this.OnCustomLoad; // Save Anywhere's AfterSave event doesn't seem to be triggered, known issue
                _saveAnywhereApi.AfterLoad  += this.OnCustomLoad;
            }

            if (Helper.ModRegistry.IsLoaded("bcmpinc.WearMoreRings") && ApiManager.HookIntoIWMR(Helper))
            {
                RingManager.wearMoreRingsApi = ApiManager.GetIWMRApi();
            }

            if (Helper.ModRegistry.IsLoaded("spacechase0.JsonAssets") && ApiManager.HookIntoJsonAssets(Helper))
            {
                _jsonAssetsApi = ApiManager.GetJsonAssetsApi();

                // Hook into IdsAssigned
                _jsonAssetsApi.IdsAssigned += this.IdsAssigned;
            }

            if (Helper.ModRegistry.IsLoaded("Pathoschild.ContentPatcher") && ApiManager.HookIntoContentPatcher(Helper))
            {
                _contentPatcherApi = ApiManager.GetContentPatcherInterface();
                _contentPatcherApi.RegisterToken(ModManifest, "Companions", new CompanionToken());
            }

            // Load any owned content packs
            this.LoadContentPacks();
        }
Ejemplo n.º 2
0
 private void OnGameLaunched(object sender,
                             GameLaunchedEventArgs e)
 {
     _jsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     _jsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath,
                                         "assets"));
 }
Ejemplo n.º 3
0
        /// <summary> Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations. </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            ApplyHarmonyPatches();
            ModConfig.SetUpModConfigMenu(Config, this);

            JsonAssetsApi = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
        }
Ejemplo n.º 4
0
        internal static void Initialize(IModHelper helper)
        {
            Helper = helper;

            CP = Helper.ModRegistry.GetApi <IContentPatcherApi>("Pathoschild.ContentPatcher");
            if (CP is null)
            {
                Log.Alert("Content Patcher is not installed - RSV requires CP to run. Please install CP and restart your game.");
                return;
            }

            JA = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            if (JA == null)
            {
                Log.Warn("Json Assets API not found. This could lead to issues.");
            }

            MR = Helper.ModRegistry.GetApi <IWearMoreRingsApi>("bcmpinc.WearMoreRings");
            if (MR == null)
            {
                Log.Trace("Wear More Rings API not found. Using base game ring slots only.");
            }

            SC = Helper.ModRegistry.GetApi <ISpaceCoreApi>("spacechase0.SpaceCore");
            if (SC == null)
            {
                Log.Warn("SpaceCore API not found. This could lead to issues.");
            }

            QF = Helper.ModRegistry.GetApi <IQuestFrameworkApi>("purrplingcat.QuestFramework");
            if (QF == null)
            {
                Log.Warn("Quest Framework API not found. This could lead to issues.");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Perform first-time checks for mod-provided APIs used for registering events and hooks, or adding custom content.
        /// </summary>
        /// <returns>Whether mod-provided APIs were initialised without issue.</returns>
        internal static bool Init()
        {
            try
            {
                if (!IsLoaded)
                {
                    IdentifyLoadedOptionalMods();

                    JsonAssets = Helper.ModRegistry
                                 .GetApi <IJsonAssetsApi>
                                     ("spacechase0.JsonAssets");
                    if (JsonAssets is null)
                    {
                        Log.E("Can't access the Json Assets API. Is the mod installed correctly?");
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                Log.E($"Failed to initialise mod-provided APIs:{Environment.NewLine}{e}");
                return(false);
            }
        }
Ejemplo n.º 6
0
        /*********
        ** Private methods
        *********/
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            JsonAssets = ModHelper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            if (JsonAssets is null)
            {
                Monitor.Log("JsonAssets is needed to load Mega Storage chests", LogLevel.Error);
                return;
            }

            ConvenientChests = ModHelper.ModRegistry.GetApi <IConvenientChestsApi>("aEnigma.ConvenientChests");
            if (!(ConvenientChests is null))
            {
                ModConfig.Instance.LargeChest.EnableCategories = false;
                ModConfig.Instance.MagicChest.EnableCategories = false;
                ModConfig.Instance.SuperMagicChest.EnableChest = false;
            }

            if (ModConfig.Instance.LargeChest.EnableChest)
            {
                JsonAssets.LoadAssets(Path.Combine(ModHelper.DirectoryPath, "assets", "LargeChest"));
            }
            if (ModConfig.Instance.MagicChest.EnableChest)
            {
                JsonAssets.LoadAssets(Path.Combine(ModHelper.DirectoryPath, "assets", "MagicChest"));
            }
            if (ModConfig.Instance.SuperMagicChest.EnableChest)
            {
                JsonAssets.LoadAssets(Path.Combine(ModHelper.DirectoryPath, "assets", "SuperMagicChest"));
            }

            JsonAssets.IdsAssigned += OnIdsAssigned;
            ItemPatcher.Start();
            SaveManager.Start();
            StateManager.Start();
        }
Ejemplo n.º 7
0
        private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            apiDGA = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets");
            apiJA  = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");


            // get Generic Mod Config Menu's API (if it's installed)
            var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu is null)
            {
                return;
            }

            // register mod
            configMenu.Register(
                mod: ModManifest,
                reset: () => Config = new ModConfig(),
                save: () => Helper.WriteConfig(Config)
                );

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => "Mod Enabled?",
                getValue: () => Config.EnableMod,
                setValue: value => Config.EnableMod = value
                );
            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => "Reset Farm Cave Event",
                tooltip: () => "Will reset the cave the next time you load a save. REMOVES ALL OBJECTS IN CAVE",
                getValue: () => Config.ResetEvent,
                setValue: value => Config.ResetEvent = value
                );
        }
Ejemplo n.º 8
0
        private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e) //Get JsonAssets Api and directory on Game launch
        {
            JA = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            JA.LoadAssets(Path.Combine(Helper.DirectoryPath, "assets"));

            hasExtendedReach = Helper.ModRegistry.IsLoaded("spacechase0.ExtendedReach");
            hasJA            = Helper.ModRegistry.IsLoaded("spacechase0.JsonAssets");

            if (!hasJA)
            {
                Monitor.Log($"JsonAssets was not loaded, the mod will force itself to stop to avoid crashes", LogLevel.Error);
                Helper.Events.GameLoop.Saving       -= GameLoop_Saving;
                Helper.Events.GameLoop.SaveLoaded   -= GameLoop_SaveLoaded;
                Helper.Events.GameLoop.GameLaunched -= GameLoop_GameLaunched;

                Helper.Events.Input.ButtonPressed -= Input_ButtonPressed;

                Helper.Events.World.ObjectListChanged -= World_ObjectListChanged;

                Helper.Events.Multiplayer.PeerConnected      -= Multiplayer_PeerConnected;
                Helper.Events.Multiplayer.ModMessageReceived -= Multiplayer_ModMessageReceived;
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 9
0
        /*******************/
        /* Private methods */
        /*******************/

        private void LoadApis()
        {
            jsonAssetsApi = Helper.ModRegistry.GetApi <IJsonAssetsApi>(jsonAssetsUniqueID);
            if (jsonAssetsApi != null)
            {
                jsonAssetsFound = true;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Register the API for Json Assets
        /// </summary>
        public static void RegisterJsonAssets()
        {
            JsonAssets = ModEntry.helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");

            if (JsonAssets == null)
            {
                ModEntry.monitor.Log("Json Assets API not detected. This is only an issue if you're using cystom Json Assets items and shops trying to sell them, as custom items will not appear in shops.",
                                     LogLevel.Info);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Register the API for Json Assets
        /// </summary>
        public static void RegisterJsonAssets()
        {
            JsonAssets = ModEntry.helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");

            if (JsonAssets == null)
            {
                ModEntry.monitor.Log("Json Assets API not detected. Custom JA items will not be added to shops.",
                                     LogLevel.Info);
            }
        }
Ejemplo n.º 12
0
 private void LoadJsonAssetsObjects()
 {
     JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Log.E("Can't access the Json Assets API. Is the mod installed correctly?");
         return;
     }
     JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, EasterPackPath));
 }
Ejemplo n.º 13
0
 private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
 {
     mJsonAssets = base.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (mJsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API for Moveable Mailbox", LogLevel.Warn);
     }
     else
     {
         mJsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "json-assets"));
     }
 }
Ejemplo n.º 14
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API, which is needed for Home Sewing Kit to function", LogLevel.Error);
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "assets"));
     }
 }
Ejemplo n.º 15
0
 private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
 {
     JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API for scarecrows");
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "assets/json-assets"));
     }
 }
Ejemplo n.º 16
0
 public void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API for Instant Growth Powder", 0);
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "assets/json-assets"));
     }
 }
Ejemplo n.º 17
0
 public void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API for Terrarium", LogLevel.Error);
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "json-assets"));
     }
 }
Ejemplo n.º 18
0
 public void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     this.JsonAssets = base.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API for Placeable Mine Shaft", 0);
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "assets/json-assets"));
     }
 }
Ejemplo n.º 19
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     JsonAssets = helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         ModEntry.monitor.Log("Json Assets API not detected: mirror and catalogue items not added", LogLevel.Info);
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(helper.DirectoryPath, "assets"));
     }
 }
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="modRegistry">An API for fetching metadata about loaded mods.</param>
        /// <param name="monitor">Encapsulates monitoring and logging.</param>
        public JsonAssetsIntegration(IModRegistry modRegistry, IMonitor monitor)
            : base("Json Assets", "spacechase0.JsonAssets", "1.3.8", modRegistry, monitor)
        {
            if (!this.IsLoaded)
            {
                return;
            }

            // get mod API
            this.ModApi   = this.GetValidatedApi <IJsonAssetsApi>();
            this.IsLoaded = this.ModApi != null;
        }
Ejemplo n.º 21
0
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var jaMod = Helper.ModRegistry.Get("spacechase0.JsonAssets").Manifest;

            ja = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            cp = Helper.ModRegistry.GetApi <IContentPatcherAPI>("Pathoschild.ContentPatcher");
            cp.RegisterToken(jaMod, "ObjectId", this.Token_ObjectId);
            cp.RegisterToken(jaMod, "BigCraftableId", this.Token_BigCraftableId);
            cp.RegisterToken(jaMod, "CropId", this.Token_CropId);
            cp.RegisterToken(jaMod, "FruitTreeId", this.Token_FruitTreeId);
            cp.RegisterToken(jaMod, "HatId", this.Token_HatId);
            cp.RegisterToken(jaMod, "WeaponId", this.Token_WeaponId);
        }
Ejemplo n.º 22
0
        internal static bool HookIntoJsonAssets(IModHelper helper)
        {
            jsonAssetsApi = helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");

            if (jsonAssetsApi is null)
            {
                monitor.Log("Failed to hook into spacechase0.JsonAssets.", LogLevel.Error);
                return(false);
            }

            monitor.Log("Successfully hooked into spacechase0.JsonAssets.", LogLevel.Debug);
            return(true);
        }
Ejemplo n.º 23
0
        /*********
        ** Private methods
        *********/
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // load Json Assets API
            this.JsonAssets = this.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            if (this.JsonAssets == null)
            {
                this.Monitor.Log("Can't access the Json Assets API. Is the mod installed correctly?", LogLevel.Error);
                return;
            }

            // inject Json Assets content pack
            this.JsonAssets.LoadAssets(Path.Combine(this.Helper.DirectoryPath, "assets", "[JA] LineSprinklers"));
        }
Ejemplo n.º 24
0
        public void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
                this.Helper.Content.InvalidateCache("Data/mail");
            }
            catch (Exception ex)
            {
                Monitor.Log("Error loading JSON assets", LogLevel.Warn);
            }

            try
            {
                GenericModConfigMenuAPI api = this.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

                if (api == null)
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new UmbrellaConfig(), () => Helper.WriteConfig(Config));

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Enable wetness",
                    "",
                    () => Config.enableWetness,
                    (bool val) => Config.enableWetness = val
                );

                api.RegisterParagraph(ModManifest, "If this box is checked, the farmer will get wet when standing outside in the rain without an umbrella. When the farmer is wet, stamina will be slowly drained. More information about the wetness system can be found on the mod page.");

                api.RegisterSimpleOption(
                    ModManifest,
                    "Stamina drain rate",
                    "",
                    () => Config.staminaDrainRate,
                    (float val) => Config.staminaDrainRate = val
                    );

                api.RegisterParagraph(ModManifest, "How much stamina to drain every 10 minutes (in game time) when the farmer is wet.");
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
        private static IEnumerable <(string key, IItemFactory itemFactory)> GetItemFactories(
            IJsonAssetsApi jaApi
            )
        {
            // Big craftables
            foreach (var(jaKey, id) in jaApi.GetAllBigCraftableIds())
            {
                var key         = $"{ItemTypes.BigCraftable}/{jaKey}";
                var itemFactory = new SimpleItemFactory(
                    ItemTypes.BigCraftable,
                    () => new SObject(Vector2.Zero, id)
                    );
                yield return(key, itemFactory);
            }

            // Clothing
            foreach (var(jaKey, id) in jaApi.GetAllClothingIds())
            {
                var key         = $"{ItemTypes.Clothing}/{jaKey}";
                var itemFactory = new SimpleItemFactory(ItemTypes.Clothing, () => new Clothing(id));
                yield return(key, itemFactory);
            }

            // Hats
            foreach (var(jaKey, id) in jaApi.GetAllHatIds())
            {
                var key         = $"{ItemTypes.Hat}/{jaKey}";
                var itemFactory = new SimpleItemFactory(ItemTypes.Hat, () => new Hat(id));
                yield return(key, itemFactory);
            }

            // Weapons
            foreach (var(jaKey, id) in jaApi.GetAllWeaponIds())
            {
                var key         = $"{ItemTypes.Weapon}/{jaKey}";
                var itemFactory = new SimpleItemFactory(
                    ItemTypes.Weapon,
                    () => new MeleeWeapon(id)
                    );
                yield return(key, itemFactory);
            }

            // Objects
            foreach (var(jaKey, id) in jaApi.GetAllObjectIds())
            {
                var key         = $"{ItemTypes.Object}/{jaKey}";
                var itemFactory = new SimpleItemFactory(ItemTypes.Object, () => new SObject(id, 1));
                yield return(key, itemFactory);
            }
        }
Ejemplo n.º 26
0
        /// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            var api = this.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");

            if (api == null)
            {
                Log.Error("No Json Assets API???");
                return;
            }
            this.Ja = api;

            api.LoadAssets(Path.Combine(this.Helper.DirectoryPath, "assets"));

            this.MoreRings = this.Helper.ModRegistry.GetApi <IMoreRingsApi>("bcmpinc.WearMoreRings");
        }
Ejemplo n.º 27
0
        private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            apiDGA = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets");
            apiJA  = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");


            // get Generic Mod Config Menu's API (if it's installed)
            var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (configMenu is null)
            {
                return;
            }

            // register mod
            configMenu.Register(
                mod: ModManifest,
                reset: () => Config = new ModConfig(),
                save: () => Helper.WriteConfig(Config)
                );

            configMenu.AddBoolOption(
                mod: ModManifest,
                name: () => "Mod Enabled?",
                getValue: () => Config.EnableMod,
                setValue: value => Config.EnableMod = value
                );
            configMenu.AddTextOption(
                mod : ModManifest,
                name : () => "Oversize % / Day",
                getValue : () => "" + Config.SizeIncreasePerDay,
                setValue : delegate(string value) { try { Config.SizeIncreasePerDay = float.Parse(value, CultureInfo.InvariantCulture); } catch { } }
                );
            configMenu.AddTextOption(
                mod : ModManifest,
                name : () => "Loot % / Oversize",
                getValue : () => "" + Config.LootIncreasePerDay,
                setValue : delegate(string value) { try { Config.LootIncreasePerDay = float.Parse(value, CultureInfo.InvariantCulture); } catch { } }
                );
            configMenu.AddNumberOption(
                mod: ModManifest,
                name: () => "Max Oversize Days",
                getValue: () => Config.MaxDaysSizeIncrease,
                setValue: value => Config.MaxDaysSizeIncrease = value
                );
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Loads Expanded Storage content pack data.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private static void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            _jsonAssetsApi              = _helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            _jsonAssetsApi.IdsAssigned += OnIdsAssigned;

            _monitor.Log($"Loading Content Packs", LogLevel.Info);
            foreach (var contentPack in _helper.ContentPacks.GetOwned())
            {
                if (!contentPack.HasFile("expandedStorage.json"))
                {
                    _monitor.Log($"Cannot load {contentPack.Manifest.Name} {contentPack.Manifest.Version} from {contentPack.Manifest.Description}", LogLevel.Warn);
                    continue;
                }
                _monitor.Log($"Loading {contentPack.Manifest.Name} {contentPack.Manifest.Version} from {contentPack.Manifest.Description}", LogLevel.Info);
                var contentData = contentPack.ReadJsonFile <ContentPackData>("expandedStorage.json");
                ExpandedStorage.AddRange(contentData.ExpandedStorage.Where(s => !string.IsNullOrWhiteSpace(s.StorageName)));
            }
        }
Ejemplo n.º 29
0
 public void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
     if (JsonAssets == null)
     {
         Monitor.Log("Can't load Json Assets API for Parrot Perch");
     }
     else
     {
         JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "json-assets"));
     }
     advancedLootFrameworkApi = context.Helper.ModRegistry.GetApi <IAdvancedLootFrameworkApi>("aedenthorn.AdvancedLootFramework");
     if (advancedLootFrameworkApi != null)
     {
         Monitor.Log($"loaded AdvancedLootFramework API", LogLevel.Debug);
         giftList = advancedLootFrameworkApi.LoadPossibleTreasures(possibleGifts.Keys.ToArray(), -1, 100);
         Monitor.Log($"Got {giftList.Count} possible treasures");
     }
 }
Ejemplo n.º 30
0
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            _catShopStock = new Dictionary <ISalable, int[]>();

            _ja = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
            if (_ja == null)
            {
                Log.E("Can't access the Json Assets API. Is the mod installed correctly?");
                return;
            }

            foreach (var pack in Const.HatPacks)
            {
                _ja.LoadAssets(Path.Combine(Helper.DirectoryPath, "Assets", Const.HatsDir, pack));
            }
            foreach (var pack in Const.ClothingPacks)
            {
                _ja.LoadAssets(Path.Combine(Helper.DirectoryPath, "Assets", Const.ClothingDir, pack));
            }
        }