mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-05 05:00:26 -04:00
Allow commands like "#take the 2 daggers"
This commit is contained in:
parent
f989d68625
commit
457d7439a1
1 changed files with 12 additions and 1 deletions
13
Input.js
13
Input.js
|
@ -2605,15 +2605,26 @@ function doTurn(command) {
|
|||
}
|
||||
|
||||
function doTake(command) {
|
||||
var itemIndex = 0
|
||||
var arg0 = getArgument(command, 0)
|
||||
if (arg0 == null) {
|
||||
state.show = "none"
|
||||
return "\n[Error: Not enough parameters. See #help]\n"
|
||||
}
|
||||
|
||||
if (arg0 == "the") {
|
||||
var tempArg = getArgument(command, 1)
|
||||
if (tempArg != null && !isNaN(tempArg)) {
|
||||
arg0 = tempArg
|
||||
itemIndex++
|
||||
}
|
||||
}
|
||||
|
||||
if (!isNaN(arg0)) itemIndex++
|
||||
|
||||
const item = {
|
||||
quantity: isNaN(arg0) ? 1 : arg0,
|
||||
name: getArgumentRemainder(command, isNaN(arg0) ? 0 : 1).replace(/^((the)|(a)|(an))\s/, "").plural(true)
|
||||
name: getArgumentRemainder(command, itemIndex).replace(/^((the)|(a)|(an))\s/, "").plural(true)
|
||||
}
|
||||
|
||||
var character = getCharacter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue