Constructor
new Weapon(id, classname, slot, preserveattributes, level, quality) → {any}
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Index of the weapon in items_game.txt |
classname |
string | Classname of the weapon in items_game.txt |
slot |
number | Slot of the weapon. Should be 1-5 |
preserveattributes |
boolean | Whether to preserve the normal weapon's attributes or not. |
level |
number | Level 1-100 of the weapon. |
quality |
number | Quality of the weapon. |
Returns:
- Type
- any
Methods
addAttribute(id, value)
Function that adds an attribute to a item. You can find a giant list of all possible attributes at the TF2 Wiki.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | ID of the attribute. |
value |
any | A number or a boolean representing the value of the attribute. |
Throws:
Will throw an error if the weapon already has 16 attributes or more. This is a limitation of TF2 itself.
setAustralium()
Turn the weapon into an australium if it can become one.
Keep in mind this method internally calls addAttribute
, and as such will throw if 16 attributes are exceeded.
Throws:
Will throw an error if the weapon cannot be Australium.
setFestivized()
If the weapon can be festivized, add the attribute for turning it into one.
Keep in mind this method internally calls addAttribute
, and as such will throw if 16 attributes are exceeded.
Throws:
Will throw an error if the weapon cannot be festivized.