mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-06 05:30:28 -04:00
Fixed all keyword with #drop. Resolve #7
This commit is contained in:
parent
47d96b643e
commit
28e3ccdcb2
1 changed files with 14 additions and 2 deletions
16
Input.js
16
Input.js
|
@ -1169,9 +1169,21 @@ function doDrop(command) {
|
|||
var haveWord = character.name == "You" ? "have" : "has"
|
||||
var tryWord = character.name == "You" ? "try" : "tries"
|
||||
|
||||
var itemArgIndex = 0
|
||||
if (isNaN(arg0)) {
|
||||
if (allSynonyms.indexOf(arg0.toLowerCase() > -1)) {
|
||||
arg0 = Number.MAX_SAFE_INTEGER
|
||||
itemArgIndex++
|
||||
} else {
|
||||
arg0 = 1
|
||||
}
|
||||
} else {
|
||||
itemArgIndex++
|
||||
}
|
||||
|
||||
const item = {
|
||||
quantity: !isNaN(arg0) ? arg0 : allSynonyms.indexOf(arg0) > - 1 ? Number.MAX_SAFE_INTEGER : 1,
|
||||
name: getArgumentRemainder(command, isNaN(arg0) ? 0 : 1).replace(/^((the)|(a)|(an))\s/, "").plural(true)
|
||||
quantity: arg0,
|
||||
name: getArgumentRemainder(command, itemArgIndex).replace(/^((the)|(a)|(an))\s/, "").plural(true)
|
||||
}
|
||||
|
||||
var displayItemName = item.name.plural(item.quantity == 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue