Line 1,385: |
Line 1,385: |
| | | |
| ===Data format=== | | ===Data format=== |
− | The weapon data in <samp>Data/Weapons</samp> consists of an integer→string dictionary with entries like this: | + | The weapon data in <samp>Data/Weapons</samp> consists of a string → model lookup, where... |
| + | * The key is the unqualified [[#Custom items|item ID]] for the weapon. |
| + | * The value is model with the fields listed below. |
| | | |
− | <syntaxhighlight lang="json">
| + | ====Basic weapon info==== |
− | "12": "Wooden Blade/Not bad for a piece of carved wood./3/7/1/0/0/0/0/3/-1/0/.02/3"
| + | {| class="wikitable" |
− | </syntaxhighlight> | + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | <samp>Name</samp> |
| + | | The internal weapon name. |
| + | |- |
| + | | <samp>DisplayName</samp><br /><samp>Description</samp> |
| + | | A [[Modding:Tokenizable strings|tokenizable string]] for the translated display name & description. |
| + | |- |
| + | | <samp>Type</samp> |
| + | | The weapon type. One of <samp>0</samp> (stabbing sword), <samp>1</samp> (dagger), <samp>2</samp> (club or hammer), or <samp>3</samp> (slashing sword). |
| + | |} |
| | | |
− | For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
| + | ====Appearance==== |
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | <samp>Texture</samp> |
| + | | The asset name for the spritesheet containing the weapon's sprite. |
| + | |- |
| + | | <samp>SpriteIndex</samp> |
| + | | The index within the <samp>Texture</samp> for the weapon sprite, where 0 is the top-left sprite. |
| + | |} |
| | | |
− | ; Melee weapons
| + | ====Stats==== |
− | : {| class="wikitable"
| + | {| class="wikitable" |
| |- | | |- |
− | ! index
| |
| ! field | | ! field |
| ! effect | | ! effect |
| |- | | |- |
− | | 0 | + | | <samp>MinDamage</samp><br /><samp>MaxDamage</samp> |
− | | name
| + | | The minimum and maximum based damage caused when hitting a monster with this weapon. |
− | | The internal weapon name (and display name in English). | |
| |- | | |- |
− | | 1 | + | | <samp>Knockback</samp> |
− | | description | + | | ''(Optional)'' How far the target is pushed when hit, as a multiplier relative to a base weapon like the [[Rusty Sword]] (e.g. <samp>1.5</samp> for 150% of Rusty Sword's weight). Default 1. |
− | | The translated item description shown in-game.
| |
| |- | | |- |
− | | 2<br />3 | + | | <samp>Speed</samp> |
− | | min damage<br />max damage
| + | | ''(Optional)'' How fast the player can swing the weapon. Each point of speed is worth 40ms of swing time relative to 0. This stacks with the [[speed|player's weapon speed]]. Default 0. |
− | | The minimum and maximum damage caused when hitting a monster with this weapon. | |
| |- | | |- |
− | | 4 | + | | <samp>Precision</samp> |
− | | knockback
| + | | ''(Optional)'' Reduces the chance that a strike will miss. Default 0. |
− | | How far the target is pushed when hit, as a multiplier relative to a base weapon like the [[Rusty Sword]] (e.g. <samp>1.5</samp> for 150% of Rusty Sword's weight).
| |
| |- | | |- |
− | | 5 | + | | <samp>Defense</samp> |
− | | speed | + | | ''(Optional)'' Reduces damage received by the player. Default 0. |
− | | How fast the player can swing the weapon. Each point of speed is worth 40ms of swing time relative to 0. This stacks with the [[speed|player's weapon speed]].
| |
| |- | | |- |
− | | 6 | + | | <samp>AreaOfEffect</samp> |
− | | added precision | + | | ''(Optional)'' Slightly increases the area of effect. Default 0. |
− | | Reduces the chance that a strike will miss.
| |
| |- | | |- |
− | | 7 | + | | <samp>CritChance</samp> |
− | | added defence | + | | ''(Optional)'' The chance of a critical hit, as a decimal value between 0 (never) and 1 (always). Default 0.02. |
− | | Reduces damage received by the player.
| |
| |- | | |- |
− | | 8 | + | | <samp>CritMultiplier</samp> |
− | | type
| + | | ''(Optional)'' A multiplier applied to the base damage for a critical hit. This can be a decimal value. Default 3. |
− | | The weapon type. One of <samp>0</samp> (stabbing sword), <samp>1</samp> (dagger), <samp>2</samp> (club or hammer), or <samp>3</samp> (slashing sword).
| + | |} |
| + | |
| + | ====Game logic==== |
| + | {| class="wikitable" |
| |- | | |- |
− | | 9<br />10
| + | ! field |
− | | base mine level<br />min mine level
| + | ! effect |
− | | The base and minimum mine level, which affect [[#Mine container drops|mine container drops]].
| |
| |- | | |- |
− | | 11 | + | | <samp>CanBeLostOnDeath</samp> |
− | | added area of effect | + | | Whether the player can [[Adventurer's Guild#Item Recovery Service|lose this tool when they die]]. Default true. |
− | | Slightly increases the area of effect. | |
| |- | | |- |
− | | 12 | + | | <samp>MineBaseLevel</samp><br /><samp>MineMinLevel</samp> |
− | | critical chance
| + | | ''(Optional)'' The base and minimum mine level, which affect [[#Mine container drops|mine container drops]]. Both default to -1, which disables automatic mine drops. |
− | | The chance of a critical hit, as a decimal value between 0 and 1. | + | |} |
| + | |
| + | ====Advanced==== |
| + | {| class="wikitable" |
| |- | | |- |
− | | 13
| + | ! field |
− | | critical damage
| + | ! effect |
− | | A multiplier applied to the damage for critical hit.
| |
| |- | | |- |
− | | 14 | + | | <samp>Projectiles</samp> |
− | | display name
| + | | ''(Optional)'' The projectiles fired when the weapon is used, which continue along their path until they hit a monster and cause damage. A separate projectile is fired for each entry in this list. |
− | | The translated item name (in non-English assets only). | |
− | |}
| |
| | | |
− | ; Slingshots
| + | This consists of a list of models with these fields (one projectile will fire for each entry in the list): |
− | : {| class="wikitable"
| + | {| class="wikitable" |
| |- | | |- |
− | ! index
| |
| ! field | | ! field |
| ! effect | | ! effect |
| |- | | |- |
− | | 0 | + | | <samp>Id</samp> |
− | | name | + | | The [[Modding:Common data field types#Unique string ID|unique string ID]] for the projectile within the current weapon's data. |
− | | The internal weapon name (and display name in English). | + | |- |
| + | | <samp>Damage</samp> |
| + | | ''(Optional)'' The amount of damage caused when the projectile hits a monster. Default 10. |
| + | |- |
| + | | <samp>Explodes</samp> |
| + | | ''(Optional)'' Whether the projectile explodes when it collides with something. Default false. |
| |- | | |- |
− | | 1 | + | | <samp>Bounces</samp> |
− | | description | + | | ''(Optional)'' The number of times the projectile can bounce off walls before being destroyed. Default 0. |
− | | The translated item description shown in-game (for non-English assets only).
| |
| |- | | |- |
− | | 2–8 | + | | <samp>MaxDistance</samp> |
− | | ''unused'' | + | | ''(Optional)'' The maximum tile distance the projectile can travel. Default 4. |
− | |
| |
| |- | | |- |
− | | 9<br />10 | + | | <samp>Velocity</samp> |
− | | base mine level<br />min mine level
| + | | ''(Optional)'' The speed at which the projectile moves. Default 10. |
− | | The base and minimum mine level, which affect [[#Mine container drops|mine container drops]]. | |
| |- | | |- |
− | | 11–13 | + | | <samp>RotationVelocity</samp> |
− | | ''unused'' | + | | ''(Optional)'' The rotation velocity. Default 32. |
− | |
| |
| |- | | |- |
− | | 14 | + | | <samp>TailLength</samp> |
− | | display name | + | | ''(Optional)'' The length of the tail which trails behind the main projectile. Default 1. |
− | | The translated item description shown in-game (for non-English assets only). | + | |- |
| + | | <samp>FireSound</samp><br /><samp>BounceSound</samp><br /><samp>CollisionSound</samp> |
| + | | ''(Optional)'' The sound played when the projectile is fired, bounces off a wall, or collides with something. All three default to none. |
| + | |- |
| + | | <samp>MinAngleOffset</samp><br /><samp>MaxAngleOffset</samp> |
| + | | ''(Optional)'' A random offset applied to the direction of the project each time it's fired. Both fields default to 0, in which case it's always shot at the 90° angle matching the player's facing direction. |
| + | |- |
| + | | <samp>SpriteIndex</samp> |
| + | | ''(Optional)'' The sprite index in the <samp>TileSheets/Projectiles</samp> asset to draw for this projectile. Defaults to 11 (a glowing-yellow-ball sprite). |
| + | |- |
| + | | <samp>Item</samp> |
| + | | ''(Optional)'' The item to shoot. If set, this overrides <samp>SpriteIndex</samp>. |
| + | |
| + | This consists of a list of models with these fields: |
| + | {| class="wikitable" |
| + | |- |
| + | ! field |
| + | ! effect |
| + | |- |
| + | | ''common fields'' |
| + | | See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported for ammo items. |
| + | |
| + | If set to an [[Modding:Item queries|item query]] which returns multiple items, one of them will be selected at random. |
| + | |} |
| |} | | |} |
| | | |
| + | Note that these are magic projectiles fired when the weapon is used, they're not aimed directly like [[slingshot]] projectiles. |
| + | |- |
| + | | <samp>CustomFields</samp> |
| + | | The [[#Custom data fields|custom fields]] for this entry. |
| + | |} |
| Weapons have a hardcoded category of -98 (<samp>Object.weaponCategory</samp>). | | Weapons have a hardcoded category of -98 (<samp>Object.weaponCategory</samp>). |
| | | |