Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/doc/lua/item.md
blob: df2d01fa58229aab6191f71d2f382400d8cf7972 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# item

The `item` table is available in all scripted items and contains functions relating to the item itself.

---

#### `String` item.name()

Returns the name of the item.

---

#### `size_t` item.count()

Returns the stack count of the item.

---

#### `size_t` item.setCount(`size_t` count)

Sets the item count. Returns any overflow.

---

#### `size_t` item.maxStack()

Returns the max number of this item that will fit in a stack.

---

#### `bool` item.matches(`ItemDescriptor` desc, [`bool` exactMatch])

Returns whether the item matches the specified item. If exactMatch is `true` then both the items' names and parameters are compared, otherwise only the items' names.

---

#### `bool` item.consume(`size_t` count)

Consumes items from the stack. Returns whether the full count was successfuly consumed.

---

#### `bool` item.empty()

Returns whether the item stack is empty.

---

#### `ItemDescriptor` item.descriptor()

Returns an item descriptor for the item.

---

#### `String` item.description()

Returns the description for the item.

---

#### `String` item.friendlyName()

Returns the short description for the item.

---

#### `int` item.rarity()

Returns the rarity for the item.

* 0 = common
* 1 = uncommon
* 2 = rare
* 3 = legendary
* 4 = essential

---

#### `String` item.rarityString()

Returns the rarity as a string.

---

#### `size_t` item.price()

Returns the item price.

---

#### `unsigned` item.fuelAmount()

Returns the item fuel amount.

---

#### `Json` item.iconDrawables()

Returns a list of the item's icon drawables.

---

#### `Json` item.dropDrawables()

Returns a list of the item's itemdrop drawables.

---

#### `String` item.largeImage()

Returns the item's configured large image, if any.

---

#### `String` item.tooltipKind()

Returns the item's tooltip kind.

---

#### `String` item.category()

Returns the item's category

---

#### `String` item.pickupSound()

Returns the item's pickup sound.

---

#### `bool` item.twoHanded()

Returns whether the item is two handed.

---

#### `float` item.timeToLive()

Returns the items's time to live.

---

#### `Json` item.learnBlueprintsOnPickup()

Returns a list of the blueprints learned on picking up this item.

---

#### `bool` item.hasItemTag(`String` itemTag)

Returns whether the set of item tags for this item contains the specified tag.

---

#### `Json` item.pickupQuestTemplates()

Returns a list of quests acquired on picking up this item.