Spaces:
Running
Running
make it so you can bulk buy all items - Follow Up Deployment
Browse files- index.html +55 -12
- prompts.txt +4 -1
index.html
CHANGED
|
@@ -151,6 +151,24 @@
|
|
| 151 |
border-bottom: 1px solid #eee;
|
| 152 |
cursor: pointer;
|
| 153 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
.inventory-item {
|
| 155 |
width: 60px;
|
| 156 |
height: 60px;
|
|
@@ -249,8 +267,17 @@
|
|
| 249 |
|
| 250 |
<div class="seed-shop" id="seed-shop">
|
| 251 |
<div class="seed-item" data-seed="carrot seed" data-price="10">
|
| 252 |
-
<
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
</div>
|
| 255 |
<div class="seed-item" data-seed="strawberry seed" data-price="20">
|
| 256 |
<span>Strawberry Seed (20 sheckles)</span>
|
|
@@ -476,25 +503,41 @@
|
|
| 476 |
|
| 477 |
document.querySelectorAll('.seed-item').forEach(item => {
|
| 478 |
item.addEventListener('click', (e) => {
|
|
|
|
|
|
|
| 479 |
e.stopPropagation();
|
| 480 |
const seedType = item.dataset.seed;
|
| 481 |
const price = parseInt(item.dataset.price);
|
|
|
|
|
|
|
| 482 |
|
| 483 |
-
if (money >=
|
| 484 |
-
money -=
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
|
|
|
|
|
|
| 491 |
updateInventory();
|
| 492 |
-
|
|
|
|
| 493 |
} else {
|
| 494 |
-
alert(
|
| 495 |
}
|
| 496 |
});
|
| 497 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
// Close seed shop when clicking outside
|
| 499 |
document.addEventListener('click', (e) => {
|
| 500 |
if (!seedShop.contains(e.target) && e.target !== buyBtn) {
|
|
|
|
| 151 |
border-bottom: 1px solid #eee;
|
| 152 |
cursor: pointer;
|
| 153 |
}
|
| 154 |
+
.quantity-btn {
|
| 155 |
+
width: 20px;
|
| 156 |
+
height: 20px;
|
| 157 |
+
background: #ddd;
|
| 158 |
+
border: none;
|
| 159 |
+
border-radius: 3px;
|
| 160 |
+
cursor: pointer;
|
| 161 |
+
display: flex;
|
| 162 |
+
align-items: center;
|
| 163 |
+
justify-content: center;
|
| 164 |
+
}
|
| 165 |
+
.quantity-btn:hover {
|
| 166 |
+
background: #ccc;
|
| 167 |
+
}
|
| 168 |
+
.quantity {
|
| 169 |
+
min-width: 20px;
|
| 170 |
+
text-align: center;
|
| 171 |
+
}
|
| 172 |
.inventory-item {
|
| 173 |
width: 60px;
|
| 174 |
height: 60px;
|
|
|
|
| 267 |
|
| 268 |
<div class="seed-shop" id="seed-shop">
|
| 269 |
<div class="seed-item" data-seed="carrot seed" data-price="10">
|
| 270 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
| 271 |
+
<div>
|
| 272 |
+
<span>Carrot Seed (10 sheckles)</span>
|
| 273 |
+
<span>Single harvest</span>
|
| 274 |
+
</div>
|
| 275 |
+
<div style="display: flex; align-items: center; gap: 5px;">
|
| 276 |
+
<button class="quantity-btn" onclick="adjustQuantity(this, -1)">-</button>
|
| 277 |
+
<span class="quantity">1</span>
|
| 278 |
+
<button class="quantity-btn" onclick="adjustQuantity(this, 1)">+</button>
|
| 279 |
+
</div>
|
| 280 |
+
</div>
|
| 281 |
</div>
|
| 282 |
<div class="seed-item" data-seed="strawberry seed" data-price="20">
|
| 283 |
<span>Strawberry Seed (20 sheckles)</span>
|
|
|
|
| 503 |
|
| 504 |
document.querySelectorAll('.seed-item').forEach(item => {
|
| 505 |
item.addEventListener('click', (e) => {
|
| 506 |
+
if (e.target.classList.contains('quantity-btn')) return;
|
| 507 |
+
|
| 508 |
e.stopPropagation();
|
| 509 |
const seedType = item.dataset.seed;
|
| 510 |
const price = parseInt(item.dataset.price);
|
| 511 |
+
const quantity = parseInt(item.querySelector('.quantity').textContent);
|
| 512 |
+
const totalCost = price * quantity;
|
| 513 |
|
| 514 |
+
if (money >= totalCost) {
|
| 515 |
+
money -= totalCost;
|
| 516 |
+
for (let i = 0; i < quantity; i++) {
|
| 517 |
+
inventory.push({
|
| 518 |
+
type: seedType,
|
| 519 |
+
pounds: seedType === 'carrot' ? 5.5 :
|
| 520 |
+
seedType === 'strawberry' ? 2 : 1,
|
| 521 |
+
isSeed: true
|
| 522 |
+
});
|
| 523 |
+
}
|
| 524 |
updateInventory();
|
| 525 |
+
// Reset quantity after purchase
|
| 526 |
+
item.querySelector('.quantity').textContent = '1';
|
| 527 |
} else {
|
| 528 |
+
alert(`Not enough sheckles! Need ${totalCost.toLocaleString()} but only have ${money.toLocaleString()}`);
|
| 529 |
}
|
| 530 |
});
|
| 531 |
});
|
| 532 |
+
|
| 533 |
+
function adjustQuantity(btn, change) {
|
| 534 |
+
const quantityEl = btn.parentElement.querySelector('.quantity');
|
| 535 |
+
let quantity = parseInt(quantityEl.textContent);
|
| 536 |
+
quantity += change;
|
| 537 |
+
if (quantity < 1) quantity = 1;
|
| 538 |
+
if (quantity > 999) quantity = 999;
|
| 539 |
+
quantityEl.textContent = quantity;
|
| 540 |
+
}
|
| 541 |
// Close seed shop when clicking outside
|
| 542 |
document.addEventListener('click', (e) => {
|
| 543 |
if (!seedShop.contains(e.target) && e.target !== buyBtn) {
|
prompts.txt
CHANGED
|
@@ -9,4 +9,7 @@ only one on each side of the garden plot
|
|
| 9 |
add like 20 more seeds with the harvestbality and able to sell and purchase and plant
|
| 10 |
add commas where they should be in all numbers
|
| 11 |
make it so after 999,999 it goes to 1m and 1b and 1t and so on
|
| 12 |
-
and in the shop make it k and m
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
add like 20 more seeds with the harvestbality and able to sell and purchase and plant
|
| 10 |
add commas where they should be in all numbers
|
| 11 |
make it so after 999,999 it goes to 1m and 1b and 1t and so on
|
| 12 |
+
and in the shop make it k and m
|
| 13 |
+
make it so you can bulk buy items
|
| 14 |
+
Make it so you can bulk buy all the seeds, and pets
|
| 15 |
+
make it so you can bulk buy all items
|