The Final commit before turn-in (hopefully)
This commit is contained in:
parent
44a4cf65bd
commit
77cb3f4613
8 changed files with 265 additions and 148 deletions
|
|
@ -6,43 +6,70 @@ export function inventoryMenuM(){
|
|||
console.clear();
|
||||
console.log("INVENTORY");
|
||||
console.log("---------");
|
||||
console.log("1) Supplies");
|
||||
console.log("2) Equipment");
|
||||
console.log("3) Exit");
|
||||
console.log("1) View");
|
||||
console.log("2) Equip Weapon");
|
||||
console.log("3) Equip Armor");
|
||||
console.log("4) Exit");
|
||||
let invChoice = userInput("Enter: ");
|
||||
switch(userInput){
|
||||
switch(invChoice){
|
||||
case "1":
|
||||
supplyInventory();
|
||||
viewInventory();
|
||||
break;
|
||||
case "2":
|
||||
equipmentInventory();
|
||||
break;
|
||||
console.log("Weapons");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory.length;){
|
||||
if (inventory[a].type == "weapon") {
|
||||
console.log((a + 1) + ") " + inventory[a].name);
|
||||
a++;
|
||||
}
|
||||
while (true) {
|
||||
console.log("-----------------");
|
||||
let equipInput = userInput("What would you like to equip?");
|
||||
if (equipInput <= a) {
|
||||
equippedWeapon = inventory[equipInput - 1];
|
||||
console.log("You have equipped: " + equippedWeapon.name);
|
||||
return;
|
||||
} else {
|
||||
console.log("Invalid Input. Please enter a valid number.");
|
||||
}
|
||||
}
|
||||
}
|
||||
case "3":
|
||||
console.log("Armor");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory[1].length;){
|
||||
if (inventory[a].type == "armor" || inventory[a].type == "parmor") {
|
||||
console.log((a + 1) + ") " + inventory[a].name);
|
||||
a++;
|
||||
}
|
||||
while (true) {
|
||||
console.log("-----------------");
|
||||
let equipInput = parseInt(userInput("What would you like to equip?"), 10);
|
||||
if (equipInput <= a) {
|
||||
equippedArmor = inventory[equipInput - 1];
|
||||
console.log("You have equipped: " + equippedArmor.name);
|
||||
return;
|
||||
} else {
|
||||
console.log("Invalid Input. Please enter a valid number.");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "4":
|
||||
break;
|
||||
default:
|
||||
console.log("Invalid Input");
|
||||
}
|
||||
}
|
||||
|
||||
//Builds the supply inventory
|
||||
function supplyInventory(){
|
||||
function viewInventory(){
|
||||
console.clear();
|
||||
console.log("SUPPLIES");
|
||||
console.log("Inventory");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory[0].length;){
|
||||
console.log((a + 1) + ") " + inventory[0][a].name);
|
||||
a++;
|
||||
}
|
||||
userInput("[Enter to return]");
|
||||
console.clear();
|
||||
inventoryMenuM();
|
||||
}
|
||||
|
||||
//Builds the equipment inventory
|
||||
function equipmentInventory(){
|
||||
console.clear();
|
||||
console.log("EQUIPMENT");
|
||||
console.log("---------");
|
||||
for(var a = 0; a < inventory[1].length;){
|
||||
console.log((a + 1) + ") " + inventory[1][a].name);
|
||||
for(var a = 0; a < inventory.length;){
|
||||
console.log((a + 1) + ") " + inventory[a].name);
|
||||
a++;
|
||||
}
|
||||
userInput("[Enter to return]");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue