|
|
| (10 intermediate revisions by 4 users not shown) |
| Line 1: |
Line 1: |
| ← [[Modding:Index|Index]] | | ← [[Modding:Items|Items]] |
|
| |
|
| This page explains how the game stores and parses hat data. This is an advanced guide for mod developers. | | This page explains how the game stores and parses hat-type item data. For items in general, see [[Modding:Items]]. |
|
| |
|
| ==Raw data== | | ==Overview== |
| Hat data is stored in <tt>Content\Data\hats.xnb</tt>, which can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]. Here's the raw data as of {{version|1.4}} for reference:
| | Hats are items that can be equipped in the player's [[hats|hat]] slot. These change the player sprite. |
|
| |
|
| {{collapse|Data|content=<source lang="json">
| | They have [[Modding:Items#Item types|item type]] <code>(H)</code> (or <code>ItemRegistry.type_hat</code> in C# code), their data in <samp>Data/Hats</samp>, their in-game sprites in <samp>Characters/Farmer/hats</samp> by default, and their code in <samp>StardewValley.Objects.Hat</samp>. |
| {
| |
| "0": "Cowboy Hat/The leather is old and cracked, but surprisingly supple. It smells musty./false/true",
| |
| "1": "Bowler Hat/Made from smooth felt./false/true",
| |
| "2": "Top Hat/A gentleman's classic./false/true",
| |
| "3": "Sombrero/A festively decorated hat made from woven straw./false/true",
| |
| "4": "Straw Hat/Light and cool, it's a farmer's delight./false/true",
| |
| "5": "Official Cap/Looks like it belonged to a postman or policeman. Either way, it's still very soft and smells okay./false/true",
| |
| "6": "Blue Bonnet/Harken back to simpler times with this prairie bonnet./false/true",
| |
| "7": "Plum Chapeau/Looks alright./false/true",
| |
| "8": "Skeleton Mask/The red eyes are glowing mysteriously./true/true",
| |
| "9": "Goblin Mask/Freak out the neighborhood with this creepy mask. Rubber ear joints for effect./true/true",
| |
| "10": "Chicken Mask/You'll be sure to get them grinning with this one./true/true",
| |
| "11": "Earmuffs/Keep your ears toasty. Lined with artisanal velvet from Castle Village./true/false",
| |
| "12": "Delicate Bow/Little pink jewels glisten as you examine it./true/false",
| |
| "13": "Tropiclip/It's shaped like a little palm tree./true/false",
| |
| "14": "Butterfly Bow/This one is very soft./true/false",
| |
| "15": "Hunter's Cap/The wool lining should stay warm deep into the forest./false/true",
| |
| "16": "Trucker Hat/Mesh in the back to keep your head cool./false/true",
| |
| "17": "Sailor's Cap/It's fresh and starchy./false/true",
| |
| "18": "Good Ol' Cap/A floppy old topper with a creased bill. Looks like it's been through a lot./false/true",
| |
| "19": "Fedora/A city-slicker's standard./false/true",
| |
| "20": "Cool Cap/It looks really faded, but it used to be a vibrant blue./false/true",
| |
| "21": "Lucky Bow/The middle is made of solid gold./true/false",
| |
| "22": "Polka Bow/This one's sure to be turn heads./true/false",
| |
| "23": "Gnome's Cap/This gnome had a very large head./false/true",
| |
| "24": "Eye Patch/You can't tell if it's real or just from a costume shop./true/true",
| |
| "25": "Santa Hat/Celebrate the magical season./false/true",
| |
| "26": "Tiara/This one has a big amethyst encircled by gold./true/true",
| |
| "27": "Hard Hat/Keep your dome in one piece./false/true",
| |
| "28": "Sou'wester/The shape helps to keep sailors dry during storms./false/true",
| |
| "29": "Daisy/A fresh spring daisy to put in your hair./true/false",
| |
| "30": "Watermelon Band/The color scheme was inspired by the beloved summer melon./true/false",
| |
| "31": "Mouse Ears/Made from synthetic fibers./true/true",
| |
| "32": "Cat Ears/Whiskers included./true/true",
| |
| "33": "Cowgal Hat/The band is studded with fake diamonds./false/true",
| |
| "34": "Cowpoke Hat/For dairy experts./false/true",
| |
| "35": "Archer's Cap/Fashionable whether you're an archer or not./false/true",
| |
| "36": "Panda Hat/A lovely panda hat./false/true",
| |
| "37": "Blue Cowboy Hat/A denim cowboy hat in cool blue./false/true",
| |
| "38": "Red Cowboy Hat/An eye-catching cowboy hat in red suede./false/true",
| |
| "39": "Cone Hat/A curiosity from a distant land./false/true",
| |
| "40": "Living Hat/It absorbs moisture from your scalp. No watering needed!/false/true",
| |
| "41": "Emily's Magic Hat/Made with love by Emily. It's 100% organic!/false/true",
| |
| "42": "Mushroom Cap/It smells earthy./false/true",
| |
| "43": "Dinosaur Hat/A hat fashioned to look like a small dinosaur./false/true",
| |
| "44": "Totem Mask/Don't worry, it won't warp your face.../true/true",
| |
| "45": "Logo Cap/A red cap with a logo on the front./false/true",
| |
| "46": "Wearable Dwarf Helm/A slightly larger, human sized version of the helmets worn by dwarves./hide/true",
| |
| "47": "Fashion Hat/A fashionable hat with a feather in the brim./false/true",
| |
| "48": "Pumpkin Mask/This must have been a pretty big pumpkin once.../hide/true",
| |
| "49": "Hair Bone/A prehistoric version of the hair bow./true/false",
| |
| "50": "Knight's Helmet/It looks just like the real thing!/hide/true",
| |
| "51": "Squire's Helmet/The face is exposed to increase air flow./hide/true",
| |
| "52": "Spotted Headscarf/A red polka-dot scarf tied around the head./hide/true",
| |
| "53": "Beanie/A warm hat with a pretty tight fit./hide/true",
| |
| "54": "Floppy Beanie/A warm hat with a looser fit./hide/true",
| |
| "55": "Fishing Hat/The wide brim keeps you shaded when you're fishing on the riverbank./false/true",
| |
| "56": "Blobfish Mask/Just as spongy as the real thing!/true/true",
| |
| "57": "Party Hat/A goofy red hat that makes any celebration more fun./false/true",
| |
| "58": "Party Hat/A goofy blue hat that makes any celebration more fun./false/true",
| |
| "59": "Party Hat/A goofy green hat that makes any celebration more fun./false/true",
| |
| "60": "Arcane Hat/The type of cowboy hat worn by a wizard./false/true",
| |
| "61": "Chef Hat/The traditional hat worn by a head chef./hide/true",
| |
| "62": "Pirate Hat/A captain's hat with a horrible skull on the front./false/true",
| |
| "63": "Flat Topped Hat/An old style of hat once considered very fashionable./false/true",
| |
| "64": "Elegant Turban/A fine black silk turban with gold trim./false/true",
| |
| "65": "White Turban/A fine white silk turban with blue trim./false/true",
| |
| "66": "Garbage Hat/It's a garbage can lid 'upcycled' into a hat.../false/true",
| |
| "67": "Golden Mask/A faithful recreation of the Calico Desert relic!/true/true",
| |
| "68": "Propeller Hat/A goofy hat with a propeller on top./false/true",
| |
| "69": "Bridal Veil/The traditional headwear for a bride./false/true",
| |
| "70": "Witch Hat/A pointy hat popular with witches./false/true",
| |
| "71": "Copper Pan/You place the copper pan on your head.../false/true",
| |
| "72": "Green Turban/A green silk turban with a gold ornament on the front./false/true",
| |
| "73": "Magic Cowboy Hat/It's shimmering with prismatic energy/false/true/Prismatic",
| |
| "74": "Magic Turban/It's shimmering with prismatic energy/false/true/Prismatic"
| |
| }</source>}}
| |
|
| |
|
| ==Format== | | ==Data format== |
| | The hat data in <samp>Data/Hats</samp> consists of a string → string lookup, where... |
| | * The key is the [[Modding:Common data field types#Item ID|unqualified item ID]]. |
| | * The value is a slash-delimited strings with the fields listed below. |
|
| |
|
| Hats have a hard-coded category of -95 (<tt>Hats.cs::Load</tt>)
| |
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
| ! Index | | ! index |
| ! Field | | ! field |
| ! Example Value | | ! effect |
| |- | | |- |
| | 0 | | | 0 |
| | Name | | | name |
| | ''Trucker Hat'' | | | The internal item name. |
| |- | | |- |
| | 1 | | | 1 |
| | Description | | | description |
| | ''Mesh in the back to keep your head cool.'' | | | The translated item description shown in-game. |
| |- | | |- |
| | 2 | | | 2 |
| | skipHairDraw | | | show real hair |
| | ''false'' | | | Whether to show the player's hairstyle as-is when the hat is worn (<samp>true</samp>), change the hairstyle to fit the hat (<samp>false</samp>), or hide their hair completely (<samp>hide</samp>). |
| |- | | |- |
| | 3 | | | 3 |
| | ignoreHairstyleOffset | | | skip hairstyle offset |
| | ''true'' | | | Whether to ignore the current style when positioning the hat (one of <samp>true</samp> or <samp>false</samp>). For example, the [[Eye Patch|eye patch]] sets <samp>true</samp> since its position isn't affected by the hair, but the [[Butterfly Bow|butterfly bow]] sets <samp>false</samp> to adjust its position on top of your hair. |
| |- | | |- |
| | 4 | | | 4 |
| | Name (for language files other than English) | | | tags |
| | ''Truckerhut'' | | | A space-separated list of "tags". These are separate from context tags, and used to contain miscellaneous information. Currently, the only tag used by the game is <samp>Prismatic</samp>, which marks a hat as prismatic and causes it to cycle through colors. |
| | |- |
| | | 5 |
| | | display name |
| | | The translated item name shown in-game. |
| | |- |
| | | 6 |
| | | sprite index |
| | | The index in the hat spritesheet used to display this hat (see field 7 for the texture layout). |
| | |- |
| | | 7 |
| | | texture name |
| | | The name of the game texture to use for the hat. If empty, the game will use the default hat sheet <samp>Characters/Farmer/hats</samp>. |
| | |
| | Each hat in the texture should have a 20x80 pixel area, consisting of four 20x20 hat sprites from top to bottom: facing down, right, left, and up. The texture can have any width and height that's evenly divisible by 20 and 80 respectively. |
| |} | | |} |
|
| |
|
| If skipHairDraw is "true", then the game will not change the character's hairstyle when they put on the hat. If set to "false", the player's hairstyle may change when they put on the hat.
| | Hats have a hardcoded category of -95 (see <samp>HatDataDefinition.GetData</samp> in the game code). |
|
| |
|
| If ignoreHairstyleOffset is set to "true", it means that the game will position the hat regardless of the hairstyle your character has. For instance, for a hat such as the Butterfly Bow, you will want to have it set to "false" so that the bow will adjust position to be attached to your character's chosen hairstyle. However, for something like the Eye Patch, that should be kept in the same position on your character's head no matter what hair you have chosen, so it should be set to "true".
| | ==See also== |
| | * [[Modding:Items]] for item data in general |
|
| |
|
| [[Category:Modding]] | | [[Category:Modding]] |
| | |
| | [[zh:模组:帽子]] |
← Items
This page explains how the game stores and parses hat-type item data. For items in general, see Modding:Items.
Overview
Hats are items that can be equipped in the player's hat slot. These change the player sprite.
They have item type (H) (or ItemRegistry.type_hat in C# code), their data in Data/Hats, their in-game sprites in Characters/Farmer/hats by default, and their code in StardewValley.Objects.Hat.
Data format
The hat data in Data/Hats consists of a string → string lookup, where...
- The key is the unqualified item ID.
- The value is a slash-delimited strings with the fields listed below.
| index
|
field
|
effect
|
| 0
|
name
|
The internal item name.
|
| 1
|
description
|
The translated item description shown in-game.
|
| 2
|
show real hair
|
Whether to show the player's hairstyle as-is when the hat is worn (true), change the hairstyle to fit the hat (false), or hide their hair completely (hide).
|
| 3
|
skip hairstyle offset
|
Whether to ignore the current style when positioning the hat (one of true or false). For example, the eye patch sets true since its position isn't affected by the hair, but the butterfly bow sets false to adjust its position on top of your hair.
|
| 4
|
tags
|
A space-separated list of "tags". These are separate from context tags, and used to contain miscellaneous information. Currently, the only tag used by the game is Prismatic, which marks a hat as prismatic and causes it to cycle through colors.
|
| 5
|
display name
|
The translated item name shown in-game.
|
| 6
|
sprite index
|
The index in the hat spritesheet used to display this hat (see field 7 for the texture layout).
|
| 7
|
texture name
|
The name of the game texture to use for the hat. If empty, the game will use the default hat sheet Characters/Farmer/hats.
Each hat in the texture should have a 20x80 pixel area, consisting of four 20x20 hat sprites from top to bottom: facing down, right, left, and up. The texture can have any width and height that's evenly divisible by 20 and 80 respectively.
|
Hats have a hardcoded category of -95 (see HatDataDefinition.GetData in the game code).
See also