The Final commit before turn-in (hopefully)

This commit is contained in:
Raktbastr 2025-04-27 21:51:07 -05:00
parent 44a4cf65bd
commit 77cb3f4613
8 changed files with 265 additions and 148 deletions

View file

@ -149,8 +149,8 @@ export function ravenRockStore() {
switch(rrInput) {
case "1":
console.log("What would you like to buy?");
let itemNum = userInput("Enter item number: ");
let itemAmt = userInput("Enter amount: ");
var itemNum = userInput("Enter item number: ");
var itemAmt = userInput("Enter amount: ");
if (itemAmt > rrInv[itemNum].amount) {
console.log("Not enough stock.");
userInput("[Enter]");
@ -164,7 +164,13 @@ export function ravenRockStore() {
rrInv[itemNum].amount -= itemAmt;
console.log("You bought " + itemAmt + " " + rrInv[itemNum].name + "(s).");
console.log("You have " + preWarMoney + " pre-war money left.");
inventory.push(rrInv[itemNum]);
if (rrInv[itemNum].name == "Food") {
food =+ itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(rrInv[itemNum].item);
}
}
console.log("Press enter to continue...");
userInput("[Enter]");
}
@ -172,7 +178,6 @@ export function ravenRockStore() {
case "2":
console.log("Leaving shop...");
return true;
break;
default:
console.log("Invalid input, try again.");
}
@ -207,10 +212,17 @@ export function vaultZeroStore() {
break;
} else {
caps -= itemAmt * vt0Inv[itemNum].price;
rrInv[itemNum].amount -= itemAmt;
vt0Inv[itemNum].amount -= itemAmt;
console.log("You bought " + itemAmt + " " + vt0Inv[itemNum].item + "(s).");
console.log("You have " + caps + " caps left.");
console.log("Press enter to continue...");
if (vt0Inv[itemNum].name == "Food") {
food = food+itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(vt0Inv[itemNum].item);
}
}
userInput("[Enter]");
}
break;
@ -255,6 +267,13 @@ export function newVegasStore() {
console.log("You bought " + itemAmt + " " + vegasInv[itemNum].item + "(s).");
console.log("You have " + caps + " caps left.");
console.log("Press enter to continue...");
if (vegasInv[itemNum].name == "Food") {
food = food+itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(vegasInv[itemNum].item);
}
}
userInput("[Enter]");
}
break;
@ -299,6 +318,13 @@ export function eurekaStore() {
eurInv[itemNum].amount -= itemAmt;
console.log("You bought " + itemAmt + " " + eurInv[itemNum].item + "(s).");
console.log("You have " + preWarMoney + " pre-war money left.");
if (eurInv[itemNum].name == "Food") {
food = food+itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(eurInv[itemNum].item);
}
}
console.log("Press enter to continue...");
userInput("[Enter]");
}
@ -343,6 +369,13 @@ export function lostHillsStore() {
lostHillsInv[itemNum].amount -= itemAmt;
console.log("You bought " + itemAmt + " " + lostHillsInv[itemNum].item + "(s).");
console.log("You have " + caps + " caps left.");
if (lostHillsInv[itemNum].name == "Food") {
food = food+itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(lostHillsInv[itemNum].item);
}
}
console.log("Press enter to continue...");
userInput("[Enter]");
}
@ -387,6 +420,13 @@ export function whitespringStore() {
whitespringInv[itemNum].amount -= itemAmt;
console.log("You bought " + itemAmt + " " + whitespringInv[itemNum].item + "(s).");
console.log("You have " + caps + " caps left.");
if (whitespringInv[itemNum].name == "Food") {
food = food+itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(whitespringInvInv[itemNum].item);
}
}
console.log("Press enter to continue...");
userInput("[Enter]");
}
@ -460,23 +500,30 @@ export function trader(tier, message) {
console.log("What would you like to do?");
console.log("1) Buy supplies");
console.log("2) Leave shop");
var rrInput = userInput("Enter: ");
switch(rrInput) {
var traderInput = userInput("Enter: ");
switch(traderInput) {
case "1":
console.log("What would you like to buy?");
let itemNum = userInput("Enter item number: ");
let itemAmt = userInput("Enter amount: ");
if (itemAmt > tempBOSStock[itemNum].amount) {
if (itemAmt > tempTraderInv[itemNum].amount) {
console.log("Not enough stock.");
break;
} else if (itemAmt * tempBOSStock[itemNum].price > caps) {
} else if (itemAmt * tempTraderInv[itemNum].price > caps) {
console.log("Not enough money.");
break;
} else {
preWarMoney -= itemAmt * tempBOSStock[itemNum].price;
preWarMoney -= itemAmt * tempTraderInv[itemNum].price;
tempBOSStock[itemNum].amount -= itemAmt;
console.log("You bought " + itemAmt + " " + tempBOSStock[itemNum].item + "(s).");
console.log("You bought " + itemAmt + " " + tempTraderInv[itemNum].item + "(s).");
console.log("You have " + caps + " caps left.");
if (tempTraderInv[itemNum].name == "Food") {
food = food+itemAmt;
} else {
for (var i = 0; i < itemAmt; i++) {
inventory.push(tempTraderInv[itemNum].item);
}
}
console.log("Press enter to continue...");
userInput("[Enter]");
}