Line 349: |
Line 349: |
| <span style="color: red;">'''TODO'''</span> | | <span style="color: red;">'''TODO'''</span> |
| | | |
− | ==Custom shop entries== | + | ==Custom shops== |
− | <span style="color: red;">'''TODO'''</span> | + | You can now create and edit shops via the new <samp>Data/Shops</samp> asset. This consists of a list of models with these fields: |
| + | |
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | <samp>ID</samp> |
| + | | A unique ID for the shop. The current vanilla shop IDs are <samp>Marnie</samp> ([[Marnie's Ranch]]), <samp>Marlon</samp> ([[Adventurer's Guild]]), and <samp>Pierre</samp> ([[Pierre's General Store]]). For a custom shop, you should use a globally unique ID which includes your mod ID like <samp>ExampleMod.Id_ShopName</samp>. |
| + | |
| + | In C# code, you can get the inventory for a custom shop using <code>Utility.GetShopStock("shop id here")</code>, or open a shop menu using <code>Game1.activeClickableMenu = new ShopMenu(new(), who: "shop id here")</code>. |
| + | |- |
| + | | <samp>ItemGroups</samp> |
| + | | The items to list in the shop inventory. This consists of a list of models with these fields: |
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | <samp>Items</samp> |
| + | | The items to add to the shop inventory if the <samp>Condition</samp> matches. This costs of a list of values with these fields: |
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | <samp>ItemID</samp> |
| + | | One of the [[#Custom items|qualified item ID]] (like <samp>(O)128</samp> for a [[pufferfish]]), or <samp>SEEDSHOP_RANDOM_WALLPAPERS</samp> (random wallpapers), or <samp>SEEDSHOP_PLAYER_ITEMS</samp> (items the player has recently sold to Pierre's store). |
| + | |- |
| + | | <samp>IsRecipe</samp> |
| + | | ''(Optional)'' Whether to add the crafting/cooking recipe for the item, instead of the item itself. Default false. |
| + | |- |
| + | | <samp>Price</samp> |
| + | | ''(Optional)'' The price to purchase the item from the shop. Defaults to the item's normal price. |
| + | |- |
| + | | <samp>IgnorePriceMultiplier</samp> |
| + | | ''(Optional)'' Whether to ignore the <samp>PriceMultiplier</samp> value set for the shop. Default false. |
| + | |- |
| + | | <samp>Stock</samp> |
| + | | ''(Optional)'' The maximum number of the item which can be purchased in one day. Default unlimited. |
| + | |} |
| + | |- |
| + | | <samp>Condition</samp> |
| + | | ''(Optional)'' A [[#Game state queries|game state query]] which indicates whether the item should be added. If omitted, the item is always added. |
| + | |
| + | Special case: if the player found [[Pierre's Missing Stocklist]], season conditions are ignored in [[Pierre's General Store]]. |
| + | |} |
| + | |- |
| + | | <samp>ShopOwner</samp> |
| + | | ''(Optional)'' The name of the NPC whose portrait to show in the shop UI. |
| + | |- |
| + | | <samp>Dialogues</samp> |
| + | | ''(Optional)'' A list of possible dialogues; each day one dialogue will be randomly chosen to show in the shop UI. Each dialogue consists of a model with these fields: |
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | <samp>Dialogue</samp> |
| + | | The dialogue text to show in the [[Modding:Dialogue|dialogue format]]. |
| + | |
| + | Translations can be loaded from a data asset by surrounding the key with square brackets. For example, <code>"[Strings\StringsFromCSFiles:ShopMenu.cs.11488]This is raw text"</code> will show something like "''Welcome to Pierre's! This is raw text''". If the translation text contains placeholder tokens like <samp>{0}</samp>, you can add a comma-delimited list of substitution values within the square brackets. Each append can be one of <samp>SuggestedItem</samp> (the name of a random item in the shop stock), <samp>PositiveAdjective</samp> (a random adjective from <samp>Strings\Lexicon:RandomPositiveAdjective_PlaceOrEvent</samp>), <samp>ArticleFor {{t|word or append code}}</samp> (''a'' or ''an'' depending on the word in English, else blank), or a literal string value. For example, <code>"[Strings\StringsFromCSFiles:ShopMenu.cs.11464,SuggestedItem,PositiveWord,ArticleFor SuggestedItem]"</code> will produce something like "''I've got an Apple that would look just wonderful in your house.''" |
| + | |
| + | If you're using [[Modding:Content Patcher|Content Patcher]] and don't need the game's substitution codes like <samp>SuggestedItem</samp>, you can also use your own translations directly with its <code>i18n</code> token instead. |
| + | |- |
| + | | <samp>Condition</samp> |
| + | | ''(Optional)'' A [[#Game state queries|game state query]] which indicates whether the dialogue should be available. If omitted, the dialogue is always available. |
| + | |} |
| + | |- |
| + | | <samp>PriceMultiplier</samp> |
| + | | ''(Optional)'' A multiplier applied to the price when buying items from the shop, like <samp>1.5</samp> for a 50% markup. Defaults to 1. |
| + | |} |
| | | |
| ==Custom fruit trees== | | ==Custom fruit trees== |