UNPKG
@0xcap/loot-table
Version:
latest (1.0.1)
1.0.1
1.0.0
0.2.0
0.1.0
A simple loot table implementation in TypeScript.
0xCAP/loot-table
@0xcap/loot-table
/
src
/
loot-item.ts
14 lines
(11 loc)
•
279 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
{ v5
as
uuid }
from
"uuid"
;
export
default
class
LootItem
<T> {
readonly
id
:
string
;
item
: T;
dropRate
:
number
;
constructor
(
item
: T,
dropRate
:
number
) {
this
.
item
= item;
this
.
dropRate
= dropRate;
this
.
id
=
uuid
(
JSON
.
stringify
(item), uuid.
URL
); } }