Fixed duplication of "the" in #take if the item has a capitalized "The" name.

This commit is contained in:
raeleus 2024-09-28 15:30:35 -07:00
parent 23821d5436
commit 503794b6e4

View file

@ -1142,7 +1142,7 @@ function doTake(command) {
if (item.quantity < 0) item.quantity = 1
var text = "\n"
if (item.quantity == 1) text += `${character.name} ${commandName} the ${displayItemName}.\n`
if (item.quantity == 1) text += `${character.name} ${commandName} ${displayItemName.toLowerCase().startsWith("the ") ? "" : "the "}${displayItemName}.\n`
else text += `${character.name} ${commandName} ${item.quantity} ${displayItemName}.\n`
var index = character.inventory.findIndex((element) => element.name.toLowerCase() == item.name.toLowerCase())