Line 1: |
Line 1: |
− | {{upcoming|1.6}}
| |
− |
| |
| ← [[Modding:Index|Index]] | | ← [[Modding:Index|Index]] |
| | | |
Line 7: |
Line 5: |
| ==Data== | | ==Data== |
| ===Format=== | | ===Format=== |
− | You can create and change shops by editing the <samp>Data/Shops</samp> asset. This consists of a string → model lookup, where the key is a [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|unique string ID]] for the shop, and the value is a model with these fields. | + | You can create and change shops by editing the <samp>Data/Shops</samp> asset. This consists of a string → model lookup, where the key is a [[Modding:Common data field types#Unique string ID|unique string ID]] for the shop, and the value is a model with these fields. |
| | | |
| {| class="wikitable" | | {| class="wikitable" |
Line 22: |
Line 20: |
| |- | | |- |
| | ''common fields'' | | | ''common fields'' |
− | | See [[#Item spawn fields|item spawn fields]] for the generic item fields supported by shop items. | + | | See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported by shop items. |
| | | |
| Notes: | | Notes: |
− | * If set to an [[#Item queries|item query]] which returns multiple items, all of them will be added to the shop. | + | * If set to an [[Modding:Item queries|item query]] which returns multiple items, all of them will be added to the shop. |
| * The <samp>MinStack</samp> and <samp>MaxStack</samp> fields apply to the item after it's purchased, and have no effect on the price or <samp>Stock</samp> limit. | | * The <samp>MinStack</samp> and <samp>MaxStack</samp> fields apply to the item after it's purchased, and have no effect on the price or <samp>Stock</samp> limit. |
| * If the player found [[Pierre's Missing Stocklist]], season conditions in the <samp>Condition</samp> field are ignored in [[Pierre's General Store]]. | | * If the player found [[Pierre's Missing Stocklist]], season conditions in the <samp>Condition</samp> field are ignored in [[Pierre's General Store]]. |
Line 33: |
Line 31: |
| |- | | |- |
| | <samp>TradeItemId</samp><br /><samp>TradeItemAmount</samp> | | | <samp>TradeItemId</samp><br /><samp>TradeItemAmount</samp> |
− | | ''(Optional)'' The [[#Custom items|qualified or unqualified item ID]] and amount which must be traded to purchase this item. Defaults to no item and 1 respectively. | + | | ''(Optional)'' The [[Modding:Migrate to Stardew Valley 1.6#Custom items|qualified or unqualified item ID]] and amount which must be traded to purchase this item. Defaults to no item and 1 respectively. |
| | | |
| If both <samp>Price</samp> and <samp>TradeItemId</samp> are specified, the player will have to provide both to get the item. | | If both <samp>Price</samp> and <samp>TradeItemId</samp> are specified, the player will have to provide both to get the item. |
Line 44: |
Line 42: |
| |- | | |- |
| | <samp>AvailableStockModifiers</samp><br /><samp>PriceModifiers</samp> | | | <samp>AvailableStockModifiers</samp><br /><samp>PriceModifiers</samp> |
− | | ''(Optional)'' [[#Quantity modifiers|Quantity modifiers]] applied to the <samp>AvailableStock</samp> or <samp>Price</samp> values. | + | | ''(Optional)'' [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|Quantity modifiers]] applied to the <samp>AvailableStock</samp> or <samp>Price</samp> values. |
| | | |
| Notes: | | Notes: |
Line 50: |
Line 48: |
| |- | | |- |
| | <samp>AvailableStockModifierMode</samp><br /><samp>PriceModifierMode</samp> | | | <samp>AvailableStockModifierMode</samp><br /><samp>PriceModifierMode</samp> |
− | | ''(Optional)'' [[#Quantity modifiers|quantity modifier modes]] which indicate what to do if multiple modifiers in the <samp>AvailableStockModifiers</samp> or <samp>PriceModifiers</samp> field apply at the same time. Default <samp>Stack</samp>. | + | | ''(Optional)'' [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|quantity modifier modes]] which indicate what to do if multiple modifiers in the <samp>AvailableStockModifiers</samp> or <samp>PriceModifiers</samp> field apply at the same time. Default <samp>Stack</samp>. |
| |- | | |- |
| | <samp>AvoidRepeat</samp> | | | <samp>AvoidRepeat</samp> |
Line 81: |
Line 79: |
| | | |
| Default <samp>Global</samp>. | | Default <samp>Global</samp>. |
| + | |- |
| + | | <samp>PerItemCondition</samp> |
| + | | ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether an item produced from the other fields should be added (e.g. to filter results from item queries like <samp>ALL_ITEMS</samp>). Defaults to always added. |
| + | |- |
| + | | <samp>ActionsOnPurchase</samp> |
| + | | ''(Optional)'' A list of [[Modding:Trigger actions|actions]] to run when the player purchases this item. These are run once per purchase click. Default none. |
| + | |
| + | For example, this can be used to start a [[Modding:Dialogue#Conversation topics|conversation topic]] when it's purchased: |
| + | <syntaxhighlight lang="js"> |
| + | "ActionsOnPurchase": [ |
| + | "AddConversationTopic {{ModId}}_PurchasedItem 5" |
| + | ] |
| + | </syntaxhighlight> |
| |} | | |} |
| |- | | |- |
Line 89: |
Line 100: |
| | ''(Optional)'' The portrait and dialogue to show in the shop menu UI, ''or'' the message to show indicating that the shop is closed if <samp>ClosedMessage</samp> is set. | | | ''(Optional)'' The portrait and dialogue to show in the shop menu UI, ''or'' the message to show indicating that the shop is closed if <samp>ClosedMessage</samp> is set. |
| | | |
− | When the [[#Map/tile property changes|<samp>Action OpenShop</samp> tile property]] specifies {{o|owner tile area}}, the first NPC within the tile area which matches an owner entry is used; if no NPCs match, the shop isn't opened. If <samp>Owners</samp> is omitted, the shop is opened regardless of whether an NPC is present, and no portrait or dialogue is shown. | + | When the [[Modding:Migrate to Stardew Valley 1.6#Map/tile property changes|<samp>Action OpenShop</samp> tile property]] specifies {{o|owner tile area}}, the first NPC within the tile area which matches an owner entry is used; if no NPCs match, the shop isn't opened. If <samp>Owners</samp> is omitted, the shop is opened regardless of whether an NPC is present, and no portrait or dialogue is shown. |
| | | |
| This consists of a list of models with these fields: | | This consists of a list of models with these fields: |
Line 113: |
Line 124: |
| | ''(Optional)'' One of... | | | ''(Optional)'' One of... |
| * the internal name of the NPC whose portrait to show; | | * the internal name of the NPC whose portrait to show; |
− | * the asset name of the texture to display. | + | * the asset name of the texture to display; |
| + | * or an empty string (or other value which doesn't match an NPC or texture asset name) to disable the portrait. |
| | | |
− | In either case, it'll draw the 64x64 pixel area in the top-left corner of the texture. If omitted, defaults to the portrait for the NPC matching the <samp>Name</samp> field (if any). If set to a value which doesn't match an NPC or texture asset name, the portrait is disabled.
| + | Defaults to the portrait for the NPC matching the <samp>Name</samp> field (if any). |
| + | |
| + | If drawn, it'll use the 64x64 pixel area in the top-left corner of the texture. |
| + | Note : it is possible that name of "none" prevents any portrait to be used. |
| |- | | |- |
| | <samp>Dialogues</samp> | | | <samp>Dialogues</samp> |
Line 125: |
Line 140: |
| |- | | |- |
| | <samp>Id</samp> | | | <samp>Id</samp> |
− | | The [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|unique string ID]] for this dialogue within the current list. | + | | The [[Modding:Common data field types#Unique string ID|unique string ID]] for this dialogue within the current list. |
| |- | | |- |
| | <samp>Dialogue</samp> | | | <samp>Dialogue</samp> |
| | The dialogue text to show, as a [[Modding:Tokenizable strings|tokenizable string]]. The resulting text is parsed using the [[Modding:Dialogue|dialogue format]]. | | | The dialogue text to show, as a [[Modding:Tokenizable strings|tokenizable string]]. The resulting text is parsed using the [[Modding:Dialogue|dialogue format]]. |
| + | |
| + | You can use an empty string (like <code>"Dialogue": ""</code>) to remove the little dialogue box. |
| |- | | |- |
| | <samp>RandomDialogue</samp> | | | <samp>RandomDialogue</samp> |
Line 148: |
Line 165: |
| | <samp>ClosedMessage</samp> | | | <samp>ClosedMessage</samp> |
| | ''(Optional)'' If set, a [[Modding:Tokenizable strings|tokenizable string]] for a 'shop is closed'-style message to show instead of opening the shop. | | | ''(Optional)'' If set, a [[Modding:Tokenizable strings|tokenizable string]] for a 'shop is closed'-style message to show instead of opening the shop. |
| + | |
| + | '''This should not be set except in a separate entry'''. Adding it to an owner entry will prevent it from being used. |
| |- | | |- |
| | <samp>RandomizeDialogueOnOpen</samp> | | | <samp>RandomizeDialogueOnOpen</samp> |
Line 181: |
Line 200: |
| |- | | |- |
| | <samp>OpenSound</samp> | | | <samp>OpenSound</samp> |
− | | ''(Optional)'' The [[#Custom audio|audio cue ID]] to play when the shop menu is opened. Defaults to <samp>dwop</samp>. | + | | ''(Optional)'' The [[Modding:Migrate to Stardew Valley 1.6#Custom audio|audio cue ID]] to play when the shop menu is opened. Defaults to <samp>dwop</samp>. |
| |- | | |- |
| | <samp>PurchaseSound</samp> | | | <samp>PurchaseSound</samp> |
− | | ''(Optional)'' The [[#Custom audio|audio cue ID]] to play when an item is purchased normally. Defaults to <samp>purchaseClick</samp>. | + | | ''(Optional)'' The [[Modding:Migrate to Stardew Valley 1.6#Custom audio|audio cue ID]] to play when an item is purchased normally. Defaults to <samp>purchaseClick</samp>. |
| |- | | |- |
| | <samp>purchaseRepeatSound</samp> | | | <samp>purchaseRepeatSound</samp> |
− | | ''(Optional)'' The [[#Custom audio|audio cue ID]] to play when accumulating a stack to purchase (e.g. by holding right-click on PC). Defaults to <samp>purchaseRepeat</samp>. | + | | ''(Optional)'' The [[Modding:Migrate to Stardew Valley 1.6#Custom audio|audio cue ID]] to play when accumulating a stack to purchase (e.g. by holding right-click on PC). Defaults to <samp>purchaseRepeat</samp>. |
| |- | | |- |
| | <samp>PriceModifiers</samp> | | | <samp>PriceModifiers</samp> |
− | | ''(Optional)'' [[#Quantity modifiers|Quantity modifiers]] applied to the sell price for items in this shop. See also <samp>PriceModifiers</samp> under <samp>Items</samp>. | + | | ''(Optional)'' [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|Quantity modifiers]] applied to the sell price for items in this shop. See also <samp>PriceModifiers</samp> under <samp>Items</samp>. |
| |- | | |- |
| | <samp>PriceModifierMode</samp> | | | <samp>PriceModifierMode</samp> |
− | | ''(Optional)'' A [[#Quantity modifiers|quantity modifier mode]] which indicates what to do if multiple modifiers in the <samp>PriceModifiers</samp> field apply at the same time. This only affects that specific field, it won't affect price modifiers under <samp>Items</samp>. Default <samp>Stack</samp>. | + | | ''(Optional)'' A [[Modding:Migrate to Stardew Valley 1.6#Quantity modifiers|quantity modifier mode]] which indicates what to do if multiple modifiers in the <samp>PriceModifiers</samp> field apply at the same time. This only affects that specific field, it won't affect price modifiers under <samp>Items</samp>. Default <samp>Stack</samp>. |
| |- | | |- |
| | <samp>VisualTheme</samp> | | | <samp>VisualTheme</samp> |
Line 217: |
Line 236: |
| |- | | |- |
| | <samp>DialogueColor</samp><br /><samp>DialogueShadowColor</samp> | | | <samp>DialogueColor</samp><br /><samp>DialogueShadowColor</samp> |
− | | ''(Optional)'' The sprite text color for the dialogue text. See [[#Color fields|color format]]. Defaults to the game's standard text color. | + | | ''(Optional)'' The sprite text color for the dialogue text. See [[Modding:Migrate to Stardew Valley 1.6#Color fields|color format]]. Defaults to the game's standard text color. |
| |- | | |- |
| | <samp>ItemRowBackgroundTexture</samp><br /><samp>ItemRowBackgroundSourceRect</samp> | | | <samp>ItemRowBackgroundTexture</samp><br /><samp>ItemRowBackgroundSourceRect</samp> |
Line 223: |
Line 242: |
| |- | | |- |
| | <samp>ItemRowBackgroundHoverColor</samp> | | | <samp>ItemRowBackgroundHoverColor</samp> |
− | | ''(Optional)'' The color tint to apply to the item row background in the shop inventory when the cursor is hovering over it, or <samp>White</samp> for no tint. See [[#Color fields|color format]]. Defaults to <samp>Wheat</samp>. | + | | ''(Optional)'' The color tint to apply to the item row background in the shop inventory when the cursor is hovering over it, or <samp>White</samp> for no tint. See [[Modding:Migrate to Stardew Valley 1.6#Color fields|color format]]. Defaults to <samp>Wheat</samp>. |
| |- | | |- |
| | <samp>ItemRowTextColor</samp> | | | <samp>ItemRowTextColor</samp> |
− | | ''(Optional)'' The sprite text color for the item text. See [[#Color fields|color format]]. Defaults to the game's standard text color. | + | | ''(Optional)'' The sprite text color for the item text. See [[Modding:Migrate to Stardew Valley 1.6#Color fields|color format]]. Defaults to the game's standard text color. |
| |- | | |- |
| | <samp>ItemIconBackgroundTexture</samp><br /><samp>ItemIconBackgroundSourceRect</samp> | | | <samp>ItemIconBackgroundTexture</samp><br /><samp>ItemIconBackgroundSourceRect</samp> |
Line 245: |
Line 264: |
| |- | | |- |
| | <samp>CustomFields</samp> | | | <samp>CustomFields</samp> |
− | | The [[#Custom data fields|custom fields]] for this entry. | + | | The [[Modding:Migrate to Stardew Valley 1.6#Custom data fields|custom fields]] for this entry. |
| |} | | |} |
| | | |
Line 446: |
Line 465: |
| | | |
| ==Open a custom shop== | | ==Open a custom shop== |
− | You can place an [[#Map/tile property changes|<samp>Action OpenShop</samp> tile property]] on the map, which will open the given shop ID when the player clicks it. | + | You can place an [[Modding:Migrate to Stardew Valley 1.6#Tile property changes|<samp>Action OpenShop</samp> tile property]] on the map, which will open the given shop ID when the player clicks it. |
| | | |
− | In C# code, you can get the inventory for a custom shop using <code>Utility.GetShopStock("shop id here")</code>, open a shop menu using <code>Utility.TryOpenShopMenu("shop id", …)</code>, and add temporary items to an open menu using <code>shopMenu.AddForSale(…)</code>. The ID of the opened shop is stored in the shop menu's <samp>storeContext</samp> field. | + | In C# code, you can get the inventory for a custom shop using <code>Utility.GetShopStock("shop id here")</code>, open a shop menu using <code>Utility.TryOpenShopMenu("shop id", …)</code>, and add temporary items to an open menu using <code>shopMenu.AddForSale(…)</code>. The ID of the opened shop is stored in the shop menu's <samp>ShopId</samp> field. |
| | | |
| [[Category:Modding]] | | [[Category:Modding]] |