1. Welcome to the official Starbound Mod repository, Guest! Not sure how to install your mods? Check out the installation guide or check out the modding help thread for more guides.
    Outdated Mods have been moved to their own category! If you update your mod please let a moderator know so we can move it back to the active section.
    Dismiss Notice

Adventure Shop Inventory 1.0.1

Make Marlon sell what you want, when you want, for how much you want.

  1. Hammurabi
    This mod allows you to alter the contents of Marlon's shop in the Adventure Guild.

    You can add weapons, boots, rings, and hats based on the deepest mine level you've reached, the number of enemies of a given type that you've killed, and/or items that you've donated to the Museum (going by either "any one thing from this list", or "everything from this list").

    You can set the prices of the items, and you can restrict the player to only being able to get a single copy of the item through the shop (not simply the shop only having one, but the player not being able to buy one if they already own one).

    You can also disable the Topaz Ring being sold, since it's completely useless. (Precision reduces the ability of monsters to "dodge" blows that connect with them, but no monster is able to dodge to begin with unless they've been modded to be able to do so).

    Additionally, I've included a config file that mixes things up a bit by including more artifact and mineral donation requirements and kill requirements, and which enables a lot of the disabled weapons, rings, and boots in the game; this config file will be used by default, but deleting it will make the mod create a blank one to use as a template.


    Source code:
    Code:
    using System;
    using System.Collections.Generic;
    using StardewModdingAPI;
    using StardewModdingAPI.Events;
    using StardewValley;
    using StardewValley.Locations;
    using StardewValley.Menus;
    using StardewValley.Objects;
    using StardewValley.Tools;
    
    namespace Adventure_Shop_Inventory {
       public class AdventureShopMod : Mod {
         public bool shopReplaced;
         public Config config;
    
         public override void Entry(IModHelper helper) {
           MenuEvents.MenuChanged += OnMenuChanged;
           MenuEvents.MenuClosed += OnMenuClosed;
           config = helper.ReadConfig<Config>();
           if (config == null) {
             config = new Config();
             helper.WriteConfig<Config>(config);
           }
         }
    
         public void OnMenuChanged(object sender, EventArgs e) {
           if (Game1.activeClickableMenu != null && Game1.activeClickableMenu is ShopMenu && !shopReplaced) {
             ShopMenu shop = (ShopMenu) Game1.activeClickableMenu;
             if (shop.portraitPerson.name.Equals("Marlon")) {
               Dictionary<Item, int[]> shopList = new Dictionary<Item, int[]>();
    
               AddWeapons(shopList);
               AddBoots(shopList);
               AddRings(shopList);
               AddHats(shopList);
    
               shopReplaced = true;
               Game1.activeClickableMenu = new ShopMenu(shopList, 0, "Marlon");
             }
           }
         }
    
         public void OnMenuClosed(object sender, EventArgs e) {
           shopReplaced = false;
         }
    
         public void AddWeapons(Dictionary<Item, int[]> shopList) {
           bool sellsWoodenBlade = false;
           bool sellsIronDirk = false;
           bool sellsSilverSaber = false;
           bool sellsPiratesSword = false;
           bool sellsCutlass = false;
           bool sellsWoodMallet = false;
           bool sellsClaymore = false;
           bool sellsTemplarsBlade = false;
           bool sellsBoneSword = false;
           bool sellsSteelFalchion = false;
           bool sellsLavaKatana = false;
           bool sellsGalaxySword = false;
           bool sellsGalaxyDagger = false;
           bool sellsGalaxyHammer = false;
           bool sellsInsectHead = false;
    
           foreach (ItemForSale entry in config.weaponList) {
             if (entry.itemID >= 0) {
               switch (entry.itemID) {
                 case 1: sellsSilverSaber = true;
                   break;
                 case 4: sellsGalaxySword = true;
                   break;
                 case 5: sellsBoneSword = true;
                   break;
                 case 7: sellsTemplarsBlade = true;
                   break;
                 case 9: sellsLavaKatana = true;
                   break;
                 case 10: sellsClaymore = true;
                   break;
                 case 12: sellsWoodenBlade = true;
                   break;
                 case 13: sellsInsectHead = true;
                   break;
                 case 17: sellsIronDirk = true;
                   break;
                 case 23: sellsGalaxyDagger = true;
                   break;
                 case 27: sellsWoodMallet = true;
                   break;
                 case 29: sellsGalaxyHammer = true;
                   break;
                 case 43: sellsPiratesSword = true;
                   break;
                 case 44: sellsCutlass = true;
                   break;
                 case 50: sellsSteelFalchion = true;
                   break;
                 default: break;
               }
    
               bool killRequirementMet = false;
               if (entry.requiredKillCount == 0 || entry.requiredKillTypes == null || entry.requiredKillTypes.Length == 0 || (entry.requiredKillTypes.Length == 1 && string.IsNullOrWhiteSpace(entry.requiredKillTypes[0]))) { killRequirementMet = true; }
               else {
                 int kills = 0;
                 foreach (string type in entry.requiredKillTypes) {
                   kills += Game1.stats.getMonstersKilled(type);
                 }
                 killRequirementMet = kills >= entry.requiredKillCount;
               }
    
               bool donationRequirementMet = entry.requiresAllDonations;
               if (entry.requiresAllDonations) {
                 if (entry.donatedItems != null && entry.donatedItems.Length > 0 && (entry.donatedItems.Length != 1 || entry.donatedItems[0] != -1)) {
                   foreach (int donationID in entry.donatedItems) {
                     if (!((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = false;
                       break;
                     }
                   }
                 }
               }
               else {
                 if (entry.donatedItems == null || entry.donatedItems.Length == 0 || (entry.donatedItems.Length == 1 && entry.donatedItems[0] == -1)) { donationRequirementMet = true; }
                 else {
                   foreach (int donationID in entry.donatedItems) {
                     if (((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = true;
                       break;
                     }
                   }
                 }
               }
    
               if (killRequirementMet && donationRequirementMet && Game1.mine.lowestLevelReached >= entry.mineLevelReached && (string.IsNullOrWhiteSpace(entry.mailReceived) || Game1.player.mailReceived.Contains(entry.mailReceived))) {
                 MeleeWeapon item = new MeleeWeapon(entry.itemID);
                 if (!entry.isUnique || !PlayerHasItem(item.name)) {
                   shopList.Add(item, new int[] {
                   entry.salePrice <= 0 ? item.getItemLevel() * item.getItemLevel() * 50 : entry.salePrice,
                   entry.isUnique ? 1 : int.MaxValue
                 });
                 }
               }
             }
           }
    
           if (config.keepDefaultsIfNotOverwritten) {
             if (!sellsWoodenBlade) { shopList.Add(new MeleeWeapon(12), new int[] { 250, int.MaxValue }); }
             if (!sellsIronDirk && Game1.mine.lowestLevelReached >= 15) { shopList.Add(new MeleeWeapon(17), new int[] { 500, int.MaxValue }); }
             if (!sellsSilverSaber && Game1.mine.lowestLevelReached >= 20) { shopList.Add(new MeleeWeapon(1), new int[] { 750, int.MaxValue }); }
             if (!sellsPiratesSword && Game1.mine.lowestLevelReached >= 25) { shopList.Add(new MeleeWeapon(43), new int[] { 850, int.MaxValue }); }
             if (!sellsCutlass && Game1.mine.lowestLevelReached >= 25) { shopList.Add(new MeleeWeapon(44), new int[] { 1500, int.MaxValue }); }
             if (!sellsWoodMallet && Game1.mine.lowestLevelReached >= 40) { shopList.Add(new MeleeWeapon(27), new int[] { 2000, int.MaxValue }); }
             if (!sellsClaymore && Game1.mine.lowestLevelReached >= 45) { shopList.Add(new MeleeWeapon(10), new int[] { 2000, int.MaxValue }); }
             if (!sellsTemplarsBlade && Game1.mine.lowestLevelReached >= 55) { shopList.Add(new MeleeWeapon(7), new int[] { 4000, int.MaxValue }); }
             if (!sellsBoneSword && Game1.mine.lowestLevelReached >= 75) { shopList.Add(new MeleeWeapon(5), new int[] { 6000, int.MaxValue }); }
             if (!sellsSteelFalchion && Game1.mine.lowestLevelReached >= 90) { shopList.Add(new MeleeWeapon(50), new int[] { 9000, int.MaxValue }); }
             if (!sellsLavaKatana && Game1.mine.lowestLevelReached >= 120) { shopList.Add(new MeleeWeapon(9), new int[] { 25000, int.MaxValue }); }
             if (!sellsInsectHead && Game1.player.mailReceived.Contains("Gil_Insect Head")) { shopList.Add(new MeleeWeapon(13), new int[] { 10000, int.MaxValue }); }
             if (Game1.player.mailReceived.Contains("galaxySword")) {
               if (!sellsGalaxySword) { shopList.Add(new MeleeWeapon(4), new int[] { 50000, int.MaxValue }); }
               if (!sellsGalaxyDagger) { shopList.Add(new MeleeWeapon(23), new int[] { 35000, int.MaxValue }); }
               if (!sellsGalaxyHammer) { shopList.Add(new MeleeWeapon(29), new int[] { 75000, int.MaxValue }); }
             }
    
             
           }
         }
    
         public void AddBoots(Dictionary<Item, int[]> shopList) {
           bool sellsSneakers = false;
           bool sellsCombatBoots = false;
           bool sellsDarkBoots = false;
    
           foreach (ItemForSale entry in config.bootList) {
             if (entry.itemID >= 0) {
               switch (entry.itemID) {
                 case 504: sellsSneakers = true;
                   break;
                 case 508: sellsCombatBoots = true;
                   break;
                 case 511: sellsDarkBoots = true;
                   break;
                 default: break;
               }
    
               bool killRequirementMet = false;
               if (entry.requiredKillCount == 0 || entry.requiredKillTypes == null || entry.requiredKillTypes.Length == 0 || (entry.requiredKillTypes.Length == 1 && string.IsNullOrWhiteSpace(entry.requiredKillTypes[0]))) { killRequirementMet = true; }
               else {
                 int kills = 0;
                 foreach (string type in entry.requiredKillTypes) {
                   kills += Game1.stats.getMonstersKilled(type);
                 }
                 killRequirementMet = kills >= entry.requiredKillCount;
               }
    
               bool donationRequirementMet = entry.requiresAllDonations;
               if (entry.requiresAllDonations) {
                 if (entry.donatedItems != null && entry.donatedItems.Length > 0 && (entry.donatedItems.Length != 1 || entry.donatedItems[0] != -1)) {
                   foreach (int donationID in entry.donatedItems) {
                     if (!((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = false;
                       break;
                     }
                   }
                 }
               }
               else {
                 if (entry.donatedItems == null || entry.donatedItems.Length == 0 || (entry.donatedItems.Length == 1 && entry.donatedItems[0] == -1)) { donationRequirementMet = true; }
                 else {
                   foreach (int donationID in entry.donatedItems) {
                     if (((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = true;
                       break;
                     }
                   }
                 }
               }
    
               if (killRequirementMet && donationRequirementMet && entry.mineLevelReached <= Game1.mine.lowestLevelReached && (string.IsNullOrWhiteSpace(entry.mailReceived) || Game1.player.mailReceived.Contains(entry.mailReceived))) {
                 Boots item = new Boots(entry.itemID);
                 if (!entry.isUnique || !PlayerHasItem(item.name)) {
                   shopList.Add(item, new int[] {
                     entry.salePrice <= 0 ? item.salePrice() * 8 : entry.salePrice,
                     entry.isUnique ? 1 : int.MaxValue
                   });
                 }
               }
             }
           }
    
           if (config.keepDefaultsIfNotOverwritten) {
             if (!sellsSneakers) { shopList.Add(new Boots(504), new int[] { 500, int.MaxValue }); }
             if (!sellsCombatBoots && Game1.mine.lowestLevelReached >= 40) { shopList.Add(new Boots(508), new int[] { 1250, int.MaxValue }); }
             if (!sellsDarkBoots && Game1.mine.lowestLevelReached >= 80) { shopList.Add(new Boots(511), new int[] { 2500, int.MaxValue }); }
           }
         }
    
         public void AddRings(Dictionary<Item, int[]> shopList) {
           bool sellsSlimeCharmerRing = false;
           bool sellsVampireRing = false;
           bool sellsSavageRing = false;
           bool sellsBurglarsRing = false;
           bool sellsAmethystRing = false;
           bool sellsTopazRing = false;
           bool sellsAquamarineRing = false;
           bool sellsJadeRing = false;
           bool sellsEmeraldRing = false;
           bool sellsRubyRing = false;
    
           foreach (ItemForSale entry in config.ringList) {
             if (entry.itemID > 515 && entry.itemID < 535 && (entry.itemID != 530 || !config.removeTopazRing)) {
               switch (entry.itemID) {
                 case 520: sellsSlimeCharmerRing = true;
                   break;
                 case 522: sellsVampireRing = true;
                   break;
                 case 523: sellsSavageRing = true;
                   break;
                 case 526: sellsBurglarsRing = true;
                   break;
                 case 529: sellsAmethystRing = true;
                   break;
                 case 530: sellsTopazRing = true;
                   break;
                 case 531: sellsAquamarineRing = true;
                   break;
                 case 532: sellsJadeRing = true;
                   break;
                 case 533: sellsEmeraldRing = true;
                   break;
                 case 534: sellsRubyRing = true;
                   break;
                 default: break;
               }
    
               bool killRequirementMet = false;
               if (entry.requiredKillCount == 0 || entry.requiredKillTypes == null || entry.requiredKillTypes.Length == 0 || (entry.requiredKillTypes.Length == 1 && string.IsNullOrWhiteSpace(entry.requiredKillTypes[0]))) { killRequirementMet = true; }
               else {
                 int kills = 0;
                 foreach (string type in entry.requiredKillTypes) {
                   kills += Game1.stats.getMonstersKilled(type);
                 }
                 killRequirementMet = kills >= entry.requiredKillCount;
               }
    
               bool donationRequirementMet = entry.requiresAllDonations;
               if (entry.requiresAllDonations) {
                 if (entry.donatedItems != null && entry.donatedItems.Length > 0 && (entry.donatedItems.Length != 1 || entry.donatedItems[0] != -1)) {
                   foreach (int donationID in entry.donatedItems) {
                     if (!((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = false;
                       break;
                     }
                   }
                 }
               }
               else {
                 if (entry.donatedItems == null || entry.donatedItems.Length == 0 || (entry.donatedItems.Length == 1 && entry.donatedItems[0] == -1)) { donationRequirementMet = true; }
                 else {
                   foreach (int donationID in entry.donatedItems) {
                     if (((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = true;
                       break;
                     }
                   }
                 }
               }
    
               if (killRequirementMet && donationRequirementMet && entry.mineLevelReached <= Game1.mine.lowestLevelReached && (string.IsNullOrWhiteSpace(entry.mailReceived) || Game1.player.mailReceived.Contains(entry.mailReceived))) {
                 Ring item = new Ring(entry.itemID);
                 if (!entry.isUnique || !PlayerHasItem(item.name)) {
                   shopList.Add(item, new int[] {
                     entry.salePrice < 1 ? item.salePrice() * 12 : entry.salePrice,
                     entry.isUnique ? 1 : int.MaxValue
                   });
                 }
               }
             }
           }
    
           if (config.keepDefaultsIfNotOverwritten) {
             if (!sellsAmethystRing) { shopList.Add(new Ring(529), new int[] { 1000, int.MaxValue }); }
             if (!sellsTopazRing && !config.removeTopazRing) { shopList.Add(new Ring(530), new int[] { 1000, int.MaxValue }); }
             if (!sellsAquamarineRing && Game1.mine.lowestLevelReached >= 40) { shopList.Add(new Ring(531), new int[] { 2500, int.MaxValue });  }
             if (!sellsJadeRing && Game1.mine.lowestLevelReached >= 40) { shopList.Add(new Ring(532), new int[] { 2500, int.MaxValue }); }
             if (!sellsEmeraldRing && Game1.mine.lowestLevelReached >= 80) { shopList.Add(new Ring(533), new int[] { 5000, int.MaxValue }); }
             if (!sellsRubyRing && Game1.mine.lowestLevelReached >= 80) { shopList.Add(new Ring(534), new int[] { 5000, int.MaxValue }); }
    
             if (!sellsVampireRing && Game1.player.mailReceived.Contains("Gil_Vampire Ring")) { shopList.Add(new Ring(522), new int[] { 15000, int.MaxValue }); }
             if (!sellsBurglarsRing && Game1.player.mailReceived.Contains("Gil_Burglar's Ring")) { shopList.Add(new Ring(526), new int[] { 20000, int.MaxValue }); }
             if (!sellsSavageRing && Game1.player.mailReceived.Contains("Gil_Savage Ring")) { shopList.Add(new Ring(523), new int[] { 25000, int.MaxValue }); }
             if (!sellsSlimeCharmerRing && Game1.player.mailReceived.Contains("Gil_Slime Charmer Ring")) { shopList.Add(new Ring(520), new int[] { 25000, int.MaxValue }); }
           }
         }
    
         public void AddHats(Dictionary<Item, int[]> shopList) {
           bool sellsSkeletonMask = false;
           bool sellsHardHat = false;
    
           foreach (ItemForSale entry in config.hatList) {
             if (entry.itemID >= 0) {
               switch (entry.itemID) {
                 case 8: sellsSkeletonMask = true;
                   break;
                 case 27: sellsHardHat = true;
                   break;
                 default: break;
               }
    
               bool killRequirementMet = false;
               if (entry.requiredKillCount == 0 || entry.requiredKillTypes == null || entry.requiredKillTypes.Length == 0 || (entry.requiredKillTypes.Length == 1 && string.IsNullOrWhiteSpace(entry.requiredKillTypes[0]))) { killRequirementMet = true; }
               else {
                 int kills = 0;
                 foreach (string type in entry.requiredKillTypes) {
                   kills += Game1.stats.getMonstersKilled(type);
                 }
                 killRequirementMet = kills >= entry.requiredKillCount;
               }
    
               bool donationRequirementMet = entry.requiresAllDonations;
               if (entry.requiresAllDonations) {
                 if (entry.donatedItems != null && entry.donatedItems.Length > 0 && (entry.donatedItems.Length != 1 || entry.donatedItems[0] != -1)) {
                   foreach (int donationID in entry.donatedItems) {
                     if (!((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = false;
                       break;
                     }
                   }
                 }
               }
               else {
                 if (entry.donatedItems == null || entry.donatedItems.Length == 0 || (entry.donatedItems.Length == 1 && entry.donatedItems[0] == -1)) { donationRequirementMet = true; }
                 else {
                   foreach (int donationID in entry.donatedItems) {
                     if (((LibraryMuseum) Game1.getLocationFromName("ArchaeologyHouse")).museumPieces.ContainsValue(donationID)) {
                       donationRequirementMet = true;
                       break;
                     }
                   }
                 }
               }
    
               if (killRequirementMet && donationRequirementMet && entry.mineLevelReached <= Game1.mine.lowestLevelReached && (string.IsNullOrWhiteSpace(entry.mailReceived) || Game1.player.mailReceived.Contains(entry.mailReceived))) {
                 Hat item = new Hat(entry.itemID);
                 if (!entry.isUnique || !PlayerHasItem(item.name)) {
                   shopList.Add(item, new int[] {
                     entry.salePrice < 1 ? 20000 : entry.salePrice,
                     entry.isUnique ? 1 : int.MaxValue
                   });
                 }
               }
             }
           }
    
           if (config.keepDefaultsIfNotOverwritten) {
             if (!sellsSkeletonMask && Game1.player.mailReceived.Contains("Gil_Skeleton Mask")) { shopList.Add(new Hat(8), new int[] { 20000, int.MaxValue }); }
             if (!sellsHardHat && Game1.player.mailReceived.Contains("Gil_Hard Hat")) { shopList.Add(new Hat(27), new int[] { 20000, int.MaxValue }); }
           }
         }
    
         public bool PlayerHasItem(string itemName) {
           if (Game1.player.hasItemWithNameThatContains(itemName) != null) { return true; }
           if (Game1.player.boots != null && Game1.player.boots.name.Equals(itemName)) { return true; }
           if (Game1.player.leftRing != null && Game1.player.leftRing.name.Equals(itemName)) { return true; }
           if (Game1.player.rightRing != null && Game1.player.rightRing.name.Equals(itemName)) { return true; }
           if (Game1.player.hat != null && Game1.player.hat.name.Equals(itemName)) { return true; }
           foreach (GameLocation loc in Game1.locations) {
             foreach (StardewValley.Object obj in loc.objects.Values) {
               if (obj is Chest && ((Chest) obj).playerChest) {
                 Chest chest = (Chest) obj;
                 foreach (Item i in chest.items) {
                   if (i.Name.Equals(itemName)) { return true; }
                 }
               }
             }
           }
    
           return false;
         }
       }
    
       public class Config {
         public bool keepDefaultsIfNotOverwritten { get; set; }
         public bool removeTopazRing { get; set; }
         public ItemForSale[] weaponList { get; set; }
         public ItemForSale[] bootList { get; set; }
         public ItemForSale[] ringList { get; set; }
         public ItemForSale[] hatList { get; set; }
    
         public Config() {
           keepDefaultsIfNotOverwritten = true;
           removeTopazRing = true;
           weaponList = new ItemForSale[] { new ItemForSale() };
           bootList = new ItemForSale[] { new ItemForSale() };
           ringList = new ItemForSale[] { new ItemForSale() };
           hatList = new ItemForSale[] { new ItemForSale() };
         }
       }
    
       public class ItemForSale {
         public int itemID { get; set; } = -1;
         public bool isUnique { get; set; } = false;
         public int salePrice { get; set; } = -1;
         public int mineLevelReached { get; set; } = -1;
         public string mailReceived { get; set; } = "";
         public int requiredKillCount { get; set; } = 0;
         public string[] requiredKillTypes { get; set; } = new string[] { "" };
         public bool requiresAllDonations { get; set; } = false;
         public int[] donatedItems { get; set; } = new int[] { -1 };
       }
    }
    
    Mod Pack Permissions:
    Anyone can use this mod in their mod compilation without the author's consent.
    Mod Assets Permissions:
    Anyone can alter/redistribute the mod's assets without the author's consent.

Recent Updates

  1. v1.0.1

Recent Reviews

  1. Floressa
    Floressa
    5/5,
    Version: 1.0.1
    Thank you so much for a very useful mod. I was able to add Nightmare's Additional Weaponry to my Adventurers guild because of this mod. The custom shop mod that is recommended to be able to purchase those weapons is very outdated. This mod enabled me to play with these weapons without them being cheaty.