2021-11-04 19:58:37 +00:00
|
|
|
export default function LookCommand(args, context) {
|
2021-11-04 21:19:50 +00:00
|
|
|
if (args.length == 1) {
|
2021-11-04 19:58:37 +00:00
|
|
|
context.examineRoom();
|
|
|
|
} else {
|
|
|
|
const room = context.getRoom(context.player.currentRoom);
|
|
|
|
const items = room.getItems();
|
|
|
|
let item = null;
|
|
|
|
for (let i of items) {
|
|
|
|
if (i.name.includes(args[1])) {
|
|
|
|
item = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!item) {
|
|
|
|
context.output.say(`I could not find a ${args[1]}`);
|
|
|
|
} else {
|
|
|
|
context.output.say(item.name);
|
|
|
|
context.output.say(item.description);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|