Line 1: |
Line 1: |
− | {{upcoming|1.6}}
| |
− |
| |
| ← [[Modding:Index|Index]] | | ← [[Modding:Index|Index]] |
| | | |
Line 40: |
Line 38: |
| Here's an example. | | Here's an example. |
| | | |
− | <pre> "ANY \"LOCATION_NAME Here BathHouse_Pool\" \"LOCATION_NAME Here BathHouse_MensLocker\" \"LOCATION_NAME Here BathHouse_WomensLocker\" \"LOCATION_NAME Here Beach, WEATHER Sun Wind, SEASON Summer\" \"EVENT_ID festival_summer5, {{HasMod|contains=spacechase0.SurfingFestival}}\""</pre> | + | <pre> "ANY \"LOCATION_NAME Here BathHouse_Pool\" \"LOCATION_NAME Here BathHouse_MensLocker\" \"LOCATION_NAME Here BathHouse_WomensLocker\" \"LOCATION_NAME Here Beach, WEATHER Sun Wind, SEASON Summer\" \"IS_EVENT festival_summer5, {{HasMod|contains=spacechase0.SurfingFestival}}\""</pre> |
| | | |
| Broken down, this means: | | Broken down, this means: |
Line 112: |
Line 110: |
| ! effect | | ! effect |
| |- | | |- |
− | | <samp>EVENT_ID {{t|event ID}}+</samp> | + | | <samp>IS_EVENT</samp> |
− | | Whether one of the given [[Modding:Event data|event]] IDs are currently playing. | + | | Whether the player is viewing any [[Modding:Event data|event]] or attending any active festival. This doesn't cover passive festivals like the [[Night Market]]. |
− | | + | |- |
− | This also works for non-passive festivals, which have IDs in the form <samp>festival_{{t|season}}{{t|day}}</samp>. For example, <samp>festival_spring13</samp> for the [[Egg Festival]].
| + | | <samp>IS_EVENT {{t|event ID}}+</samp> |
| + | | Whether the player is viewing an [[Modding:Event data|event]] or attending an active festival whose ID matches one of the specified {{t|event ID}} values. Festivals have IDs in the form <samp>festival_{{t|season}}{{t|day}}</samp> (like <samp>festival_spring13</samp> for the [[Egg Festival]]). |
| |} | | |} |
| | | |
Line 144: |
Line 143: |
| | Whether there are fewer of the given building constructed than there are cabins. | | | Whether there are fewer of the given building constructed than there are cabins. |
| |- | | |- |
− | | <samp>FARM_CAVE {{t|type}}</samp> | + | | <samp>FARM_CAVE {{t|type}}+</samp> |
| | The current [[The Farm#The Cave|farm cave]] (one of <samp>Bats</samp>, <samp>Mushrooms</samp>, or <samp>None</samp>). | | | The current [[The Farm#The Cave|farm cave]] (one of <samp>Bats</samp>, <samp>Mushrooms</samp>, or <samp>None</samp>). |
| |- | | |- |
Line 150: |
Line 149: |
| | The name of the farm. | | | The name of the farm. |
| |- | | |- |
− | | <samp>FARM_TYPE {{t|type}}</samp> | + | | <samp>FARM_TYPE {{t|type}}+</samp> |
| | The [[Farm Maps|farm type]]. The {{t|type}} can be one of... | | | The [[Farm Maps|farm type]]. The {{t|type}} can be one of... |
| * a numeric ID for a vanilla farm type: <samp>1</samp> (standard), <samp>2</samp> (riverland), <samp>3</samp> (forest), <samp>4</samp> (hilltop), <samp>5</samp> (combat), <samp>6</samp> (four corners), or <samp>7</samp> (beach); | | * a numeric ID for a vanilla farm type: <samp>1</samp> (standard), <samp>2</samp> (riverland), <samp>3</samp> (forest), <samp>4</samp> (hilltop), <samp>5</samp> (combat), <samp>6</samp> (four corners), or <samp>7</samp> (beach); |
Line 186: |
Line 185: |
| | Whether the [[#Target location|given location]] is accessible. For vanilla locations, this is relevant to <samp>CommunityCenter</samp>, <samp>JojaMart</samp>, or <samp>Railroad</samp>; any other location will return true unless a mod customizes the query. | | | Whether the [[#Target location|given location]] is accessible. For vanilla locations, this is relevant to <samp>CommunityCenter</samp>, <samp>JojaMart</samp>, or <samp>Railroad</samp>; any other location will return true unless a mod customizes the query. |
| |- | | |- |
− | | <samp>LOCATION_CONTEXT {{t|location}}</samp> | + | | <samp>LOCATION_CONTEXT {{t|location}} {{t|context ID}}+</samp> |
− | | The location context name for the [[#Target location|given location]]. | + | | The location context ID for the [[#Target location|given location]]. |
| + | |- |
| + | | <samp>LOCATION_HAS_CUSTOM_FIELD {{t|location}} {{t|key}} {{o|value}}</samp> |
| + | | Checks to see if the location has a given value in its CustomFields. If the value is omitted, checks to see if the key exists at all. |
| |- | | |- |
| | <samp>LOCATION_IS_INDOORS {{t|location}}</samp><br /><samp>LOCATION_IS_OUTDOORS {{t|location}}</samp><br /><samp>LOCATION_IS_MINES {{t|location}}</samp><br /><samp>LOCATION_IS_SKULL_CAVE {{t|location}}</samp> | | | <samp>LOCATION_IS_INDOORS {{t|location}}</samp><br /><samp>LOCATION_IS_OUTDOORS {{t|location}}</samp><br /><samp>LOCATION_IS_MINES {{t|location}}</samp><br /><samp>LOCATION_IS_SKULL_CAVE {{t|location}}</samp> |
Line 256: |
Line 258: |
| | For numeric properties only, whether a property on <samp>Game1.netWorldState</samp> has a value between {{t|min}} and {{o|max}} (default unlimited). If {{o|max}} is omitted or the properties isn't numeric, the previous form is used. See the previous entry for a list of useful properties. | | | For numeric properties only, whether a property on <samp>Game1.netWorldState</samp> has a value between {{t|min}} and {{o|max}} (default unlimited). If {{o|max}} is omitted or the properties isn't numeric, the previous form is used. See the previous entry for a list of useful properties. |
| |- | | |- |
− | | <samp>WORLD_STATE_ID {{t|id}}</samp> | + | | <samp>WORLD_STATE_ID {{t|id}}+</samp> |
− | | Whether any world state flag with the given {{t|id}} is set. | + | | Whether any world state flag matching the given {{t|id}} values is set. |
| |} | | |} |
| | | |
Line 296: |
Line 298: |
| | Whether the [[#Target player|specified player(s)]] have a [[Modding:Dialogue#Conversation topics|conversation topic]] with the ID {{t|id}} active. | | | Whether the [[#Target player|specified player(s)]] have a [[Modding:Dialogue#Conversation topics|conversation topic]] with the ID {{t|id}} active. |
| |- | | |- |
− | | <samp>PLAYER_HAS_CRAFTING_RECIPE {{t|player}} {{t|recipe name}}</samp><br /><samp>PLAYER_HAS_COOKING_RECIPE {{t|player}} {{t|recipe name}}</samp> | + | | <samp>PLAYER_HAS_COOKING_RECIPE {{t|player}} {{t|recipe name}}</samp><br /><samp>PLAYER_HAS_CRAFTING_RECIPE {{t|player}} {{t|recipe name}}</samp> |
| | Whether the [[#Target player|specified player(s)]] know the crafting/cooking recipe identified by its internal name (spaces allowed). For example, <code>PLAYER_HAS_CRAFTING_RECIPE Current Field Snack</code>. | | | Whether the [[#Target player|specified player(s)]] know the crafting/cooking recipe identified by its internal name (spaces allowed). For example, <code>PLAYER_HAS_CRAFTING_RECIPE Current Field Snack</code>. |
| |- | | |- |
| | <samp>PLAYER_HAS_DIALOGUE_ANSWER {{t|player}} {{t|id}}</samp> | | | <samp>PLAYER_HAS_DIALOGUE_ANSWER {{t|player}} {{t|id}}</samp> |
| | Whether the [[#Target player|specified player(s)]] have chosen the given dialogue answer in a previous dialogue. | | | Whether the [[#Target player|specified player(s)]] have chosen the given dialogue answer in a previous dialogue. |
| + | |- |
| + | | <samp>PLAYER_HAS_HEARD_SONG {{t|player}} {{t|id}}</samp> |
| + | | Whether the [[#Target player|specified player(s)]] have heard a song track's cue name (e.g. for the [[jukebox]] track selection). |
| + | |- |
| + | | <samp>PLAYER_HAS_ITEM {{t|player}} {{t|item}} {{o|min}} {{o|max}}</samp> |
| + | | Whether the [[#Target player|specified player(s)]] have between {{o|min}} and {{o|max}} (default unlimited) matching items in their inventory, inclusively. The {{t|item}} can be <samp>858</samp> or <samp>(O)858</samp> (Qi Gems), <samp>73</samp> or <samp>(O)73</samp> (Walnuts), or the [[Modding:Common data field types#Item ID|qualified or unqualified item ID]]. |
| |- | | |- |
| | <samp>PLAYER_HAS_MAIL {{t|player}} {{t|mail id}} {{o|type}}</samp> | | | <samp>PLAYER_HAS_MAIL {{t|player}} {{t|mail id}} {{o|type}}</samp> |
Line 325: |
Line 333: |
| * or has no letter in <samp>Data/mail</samp>, so it was added to the received list directly. | | * or has no letter in <samp>Data/mail</samp>, so it was added to the received list directly. |
| |} | | |} |
− | |-
| |
− | | <samp>PLAYER_HAS_ITEM {{t|player}} {{t|item}} {{o|min}} {{o|max}}</samp>
| |
− | | Whether the [[#Target player|specified player(s)]] have between {{o|min}} and {{o|max}} (default unlimited) matching items in their inventory, inclusively. The {{t|item}} can be <samp>858</samp> or <samp>(O)858</samp> (Qi Gems), <samp>73</samp> or <samp>(O)73</samp> (Walnuts), or the [[Modding:Common data field types#Item ID|qualified or unqualified item ID]].
| |
| |- | | |- |
| | <samp>PLAYER_HAS_PROFESSION {{t|player}} {{t|profession id}}</samp> | | | <samp>PLAYER_HAS_PROFESSION {{t|player}} {{t|profession id}}</samp> |
Line 350: |
Line 355: |
| | Whether the [[#Target player|specified player(s)]] are in the given [[Modding:Migrate to Stardew Valley 1.6#Custom location contexts|location context]]. | | | Whether the [[#Target player|specified player(s)]] are in the given [[Modding:Migrate to Stardew Valley 1.6#Custom location contexts|location context]]. |
| |- | | |- |
− | | <samp>PLAYER_LOCATION_NAME {{t|player}} {{t|location name}}</samp><br /><samp>PLAYER_LOCATION_UNIQUE_NAME {{t|player}} {{t|location name}}</samp> | + | | <samp>PLAYER_LOCATION_NAME {{t|player}} {{t|location name}}+</samp><br /><samp>PLAYER_LOCATION_UNIQUE_NAME {{t|player}} {{t|location name}}+</samp> |
| | Whether the [[#Target player|specified player(s)]] are in the given location, using the name or unique instanced name (you can see both names in-game using the {{nexus mod|679|Debug Mode}} mod). The {{t|location name}} value doesn't recognize [[#Target location|target location keywords]] like <samp>Here</samp>. | | | Whether the [[#Target player|specified player(s)]] are in the given location, using the name or unique instanced name (you can see both names in-game using the {{nexus mod|679|Debug Mode}} mod). The {{t|location name}} value doesn't recognize [[#Target location|target location keywords]] like <samp>Here</samp>. |
| |- | | |- |
Line 359: |
Line 364: |
| | Whether the [[#Target player|specified player(s)]] have earned between {{t|min}} and {{o|max}} (default unlimited) gold inclusively. | | | Whether the [[#Target player|specified player(s)]] have earned between {{t|min}} and {{o|max}} (default unlimited) gold inclusively. |
| |- | | |- |
− | | <samp>PLAYER_MONSTERS_KILLED {{t|player}} {{t|monster name}}+ {{o|min count}} {{o|max count}}</samp> | + | | <samp>PLAYER_KILLED_MONSTERS {{t|player}} {{t|monster name}}+ {{o|min count}} {{o|max count}}</samp> |
| | Whether the [[#Target player|specified player(s)]] have killed the given monster(s) between {{o|min count}} (default 1) and {{o|max count}} (default unlimited) times inclusively. If you list multiple monsters, it'll check the combined count for all of them. | | | Whether the [[#Target player|specified player(s)]] have killed the given monster(s) between {{o|min count}} (default 1) and {{o|max count}} (default unlimited) times inclusively. If you list multiple monsters, it'll check the combined count for all of them. |
| | | |
Line 443: |
Line 448: |
| * <samp>weedsEliminated</samp>. | | * <samp>weedsEliminated</samp>. |
| |- | | |- |
− | | <samp>PLAYER_VISITED_LOCATION {{t|player}} {{t|location name}}</samp> | + | | <samp>PLAYER_VISITED_LOCATION {{t|player}} {{t|location name}}+</samp> |
− | | Whether the [[#Target player|specified player(s)]] have visited a given location name. For example, <code>PLAYER_VISITED_LOCATION Current IslandWest</code> checks whether the current player has ever visited [[Ginger Island#Island West|Ginger Island West]]. | + | | Whether the [[#Target player|specified player(s)]] have visited one of the given location names. For example, <code>PLAYER_VISITED_LOCATION Current IslandWest</code> checks whether the current player has ever visited [[Ginger Island#Island West|Ginger Island West]]. |
| | | |
| Notes: | | Notes: |
Line 475: |
Line 480: |
| <pre>PLAYER_HEARTS Current Abigail 3</pre> | | <pre>PLAYER_HEARTS Current Abigail 3</pre> |
| |- | | |- |
− | | <samp>PLAYER_HAS_MET {{t|player}} {{t|npc}}</samp> | + | | <samp>PLAYER_HAS_MET {{t|player}} {{t|npc}}+</samp> |
− | | Whether the [[#Target player|specified player(s)]] have talked to an NPC at least once. The {{t|npc}} is an NPC's internal name. | + | | Whether the [[#Target player|specified player(s)]] have talked to one of the given NPCs at least once. The {{t|npc}} is an NPC's internal name. |
| |- | | |- |
| | <samp>PLAYER_NPC_RELATIONSHIP {{t|player}} {{t|npc}} {{t|type}}+</samp> | | | <samp>PLAYER_NPC_RELATIONSHIP {{t|player}} {{t|npc}} {{t|type}}+</samp> |
Line 525: |
Line 530: |
| |} | | |} |
| |- | | |- |
− | | <samp>PLAYER_PREFERRED_PET {{t|player}} {{t|pet}}</samp> | + | | <samp>PLAYER_PREFERRED_PET {{t|player}} {{t|pet type}}+</samp> |
− | | Whether the preferred pet for the [[#Target player|specified player(s)]] is <samp>Cat</samp>, <samp>Dog</samp>, or a specified custom pet type. | + | | Whether the preferred pet for the [[#Target player|specified player(s)]] is one of the given types. The vanilla pet types are <samp>Cat</samp> and <samp>Dog</samp>. |
| |} | | |} |
| | | |
Line 591: |
Line 596: |
| |- | | |- |
| | <samp>ITEM_PRICE {{t|target}} {{t|min}} {{o|max}}</samp> | | | <samp>ITEM_PRICE {{t|target}} {{t|min}} {{o|max}}</samp> |
− | | Whether the item has a sell-to-shop price between {{t|min}} and {{o|max}} (default highest possible value). | + | | Whether the item has a purchase-from-shop price between {{t|min}} and {{o|max}} (default highest possible value). |
| |- | | |- |
| | <samp>ITEM_QUALITY {{t|target}} {{t|min}} {{o|max}}</samp> | | | <samp>ITEM_QUALITY {{t|target}} {{t|min}} {{o|max}}</samp> |
Line 692: |
Line 697: |
| | | |
| ===Extensibility=== | | ===Extensibility=== |
− | C# mods can check if a query exists using <code>GameStateQuery.Exists("Example.ModId_ConditionName")</code>, and define custom conditions using <code>GameStateQuery.Register("Example.ModId_ConditionName", handleQueryMethod)</code>. To avoid conflicts, custom query names should apply the [[Modding:Common data field types#Unique string ID|unique string ID]] conventions. | + | C# mods can... |
| + | * check if a query exists using <code>GameStateQuery.Exists("Example.ModId_ConditionName")</code>; |
| + | * define custom queries using <code>GameStateQuery.Register("Example.ModId_ConditionName", handleQueryMethod)</code> (using a [[Modding:Common data field types#Unique string ID|unique string ID]] for the query name); |
| + | * and add query aliases using <code>GameStateQuery.RegisterAlias("Example.ModId_AliasName", "Example.ModId_ConditionName")</code> (ideally using a [[Modding:Common data field types#Unique string ID|unique string ID]] for the alias). |
| | | |
| [[Category:Modding]] | | [[Category:Modding]] |