Compare commits
No commits in common. "393bcb1960ba2baf5ece0b19137aca7ebb002358" and "73bf96ee8c6204489a070f31f7def4aa0bd42132" have entirely different histories.
393bcb1960
...
73bf96ee8c
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
||||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M20 4L3 9.31372L10.5 13.5M20 4L14.5 21L10.5 13.5M20 4L10.5 13.5" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
<circle cx="7" cy="7" r="4" fill="red" />
|
|
||||||
<circle cx="7" cy="7" r="1.5" fill="white" />
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 472 B |
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
||||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M20 4L3 9.31372L10.5 13.5M20 4L14.5 21L10.5 13.5M20 4L10.5 13.5" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 387 B |
|
@ -10,7 +10,6 @@ interface Props {
|
||||||
image: string;
|
image: string;
|
||||||
button_type: string;
|
button_type: string;
|
||||||
button_name: string;
|
button_name: string;
|
||||||
has_amount_input?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getHighestWeightedLanguage(Astro.request.headers.get('accept-language')));
|
const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getHighestWeightedLanguage(Astro.request.headers.get('accept-language')));
|
||||||
|
@ -18,14 +17,10 @@ const lang = await getLocales(Astro.cookies.get('language')?.value ?? await getH
|
||||||
<div class="item-card" data-id={Astro.props.id}>
|
<div class="item-card" data-id={Astro.props.id}>
|
||||||
<img class="item-card-image" src={Astro.props.image} />
|
<img class="item-card-image" src={Astro.props.image} />
|
||||||
<div class="item-card-main-field">
|
<div class="item-card-main-field">
|
||||||
<form method="post">
|
<div class="item-card-name">{Astro.props.name} | {Astro.props.level}</div>
|
||||||
<input type="hidden" name="id" value={Astro.props.id} />
|
<div class="item-card-description">{Astro.props.description} <a href={`/wiki/${Astro.props.category}/${Astro.props.id}`}>[more]</a></div>
|
||||||
<div class="item-card-name">{Astro.props.name} | {Astro.props.level}</div>
|
<form method="post"><input type="hidden" name="id" value={Astro.props.id} /><input type="submit" class="item-card-build" value={getName(lang, Astro.props.button_type, Astro.props.button_name)} /></form>
|
||||||
<div class="item-card-description">{Astro.props.description} <a href={`/wiki/${Astro.props.category}/${Astro.props.id}`}>[more]</a></div>
|
<div class="item-card-info-button">i</div>
|
||||||
<input type="submit" class="item-card-build" value={getName(lang, Astro.props.button_type, Astro.props.button_name)} />
|
|
||||||
<div class="item-card-info-button">i</div>
|
|
||||||
{Astro.props.has_amount_input === "true" && <input type="number" name="amount" />}
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
---
|
---
|
||||||
import { ObjectId } from 'mongodb';
|
|
||||||
import { checkForUnreadMails } from '../lib/db/mails';
|
|
||||||
import { getHighestWeightedLanguage, getLocales, getName } from '../lib/utils/langDriver';
|
import { getHighestWeightedLanguage, getLocales, getName } from '../lib/utils/langDriver';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -135,9 +133,6 @@ const topRow = filteredList.filter(element => element.position === "top");
|
||||||
const bottomRow = filteredList.filter(element => element.position === "bottom");
|
const bottomRow = filteredList.filter(element => element.position === "bottom");
|
||||||
|
|
||||||
const username = Astro.cookies.get('username')?.value ?? "";
|
const username = Astro.cookies.get('username')?.value ?? "";
|
||||||
const userId = Astro.cookies.get('userid')?.value ?? 0;
|
|
||||||
|
|
||||||
const hasUnreadMail = await checkForUnreadMails(new ObjectId(userId));
|
|
||||||
---
|
---
|
||||||
<nav>
|
<nav>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -154,7 +149,6 @@ const hasUnreadMail = await checkForUnreadMails(new ObjectId(userId));
|
||||||
)}
|
)}
|
||||||
<li class="nav-item"><span class="nav-username nav-keep-right">{username}</span></li>
|
<li class="nav-item"><span class="nav-username nav-keep-right">{username}</span></li>
|
||||||
{loggedIn === "true" ? <li class="nav-item"><img src="/gargamel.png" class="avatar-icon" /></li> : ""}
|
{loggedIn === "true" ? <li class="nav-item"><img src="/gargamel.png" class="avatar-icon" /></li> : ""}
|
||||||
{loggedIn === "true" ? <li class="nav-item"><a href="/game/mail"><img src={`/mail${hasUnreadMail ? "-notif" : ""}.svg?${new Date().getTime()}`} class="mail-icon" /></a></li> : ""}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -210,7 +204,7 @@ nav ul {
|
||||||
|
|
||||||
.nav-keep-right {
|
.nav-keep-right {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 140px;
|
right: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
|
@ -222,14 +216,6 @@ nav ul {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 1px solid white;
|
border: 1px solid white;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 73px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mail-icon {
|
|
||||||
height: 50px;
|
|
||||||
border-radius: 50%;
|
|
||||||
/* border: 1px solid white; */
|
|
||||||
position: absolute;
|
|
||||||
right: 13px;
|
right: 13px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -4,7 +4,6 @@ import DBFleet from "../../../types/db/DBFleet";
|
||||||
import { updateFleet } from "../../db/fleet";
|
import { updateFleet } from "../../db/fleet";
|
||||||
import { Planet } from "./PlanetManager";
|
import { Planet } from "./PlanetManager";
|
||||||
import SystemManager, { System } from "./SystemManager";
|
import SystemManager, { System } from "./SystemManager";
|
||||||
import { sendMail } from "../../db/mails";
|
|
||||||
|
|
||||||
export type Fleet = {
|
export type Fleet = {
|
||||||
id: ObjectId,
|
id: ObjectId,
|
||||||
|
@ -78,15 +77,6 @@ export default class FleetManager {
|
||||||
await this.data.source.resources.updateAmount(this.data.cargo);
|
await this.data.source.resources.updateAmount(this.data.cargo);
|
||||||
await this.data.source.ships.sync();
|
await this.data.source.ships.sync();
|
||||||
await this.data.source.resources.sync();
|
await this.data.source.resources.sync();
|
||||||
await sendMail(
|
|
||||||
null,
|
|
||||||
this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id,
|
|
||||||
this.data.arrivalTime,
|
|
||||||
"Fleet Returned",
|
|
||||||
`Your fleet from ${this.data.destination instanceof SystemManager ? `${this.data.destination.data.name} system` : `planet ${this.data.destination.name}`} has returned.\n
|
|
||||||
Ships: ${this.data.ships.map(ship => `${ship.amount} ${ship.id}`).join(', ')}\n
|
|
||||||
Cargo: ${this.data.cargo.length > 0 ? this.data.cargo.map(cargo => `${cargo.amount} ${cargo.id}`).join(', ') : 'None'}`
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
switch(this.data.mission) {
|
switch(this.data.mission) {
|
||||||
|
@ -95,38 +85,17 @@ export default class FleetManager {
|
||||||
case 'TRANSPORT':
|
case 'TRANSPORT':
|
||||||
await this.data.destination.resources.updateAmount(this.data.cargo);
|
await this.data.destination.resources.updateAmount(this.data.cargo);
|
||||||
await this.data.destination.resources.sync();
|
await this.data.destination.resources.sync();
|
||||||
const cargo = JSON.parse(JSON.stringify(this.data.cargo)) as Array<{ id: string, amount: number }>;
|
|
||||||
this.data.cargo = [];
|
this.data.cargo = [];
|
||||||
const arrived = new Date(this.data.arrivalTime);
|
|
||||||
await this.initiateReturn();
|
await this.initiateReturn();
|
||||||
await sendMail(
|
|
||||||
null,
|
|
||||||
this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id,
|
|
||||||
arrived,
|
|
||||||
"Fleet Arrived",
|
|
||||||
`Your fleet has arrived at ${this.data.destination instanceof SystemManager ? `${this.data.destination.data.name} system` : `planet ${this.data.destination.name}`}.\n
|
|
||||||
Ships: ${this.data.ships.map(ship => `${ship.amount} ${ship.id}`).join(', ')}\n
|
|
||||||
Cargo delivered: ${cargo.length > 0 ? cargo.map(cargo => `${cargo.amount} ${cargo.id}`).join(', ') : 'None'}\n
|
|
||||||
Fleet will return at ${this.data.arrivalTime}`
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
case 'TRANSFER':
|
case 'TRANSFER':
|
||||||
await this.data.destination.resources.updateAmount(this.data.cargo);
|
await this.data.destination.resources.updateAmount(this.data.cargo);
|
||||||
await this.data.destination.resources.sync();
|
await this.data.destination.resources.sync();
|
||||||
|
this.data.cargo = [];
|
||||||
for(const ship of this.data.ships) {
|
for(const ship of this.data.ships) {
|
||||||
this.data.destination.ships.addShips(ship.id, ship.amount);
|
this.data.destination.ships.addShips(ship.id, ship.amount);
|
||||||
}
|
}
|
||||||
await this.data.destination.ships.sync();
|
await this.data.destination.ships.sync();
|
||||||
await sendMail(
|
|
||||||
null,
|
|
||||||
this.data.source instanceof SystemManager ? this.data.source.data.ownedBy.id : this.data.source.system.data.ownedBy.id,
|
|
||||||
this.data.arrivalTime,
|
|
||||||
"Fleet Arrived",
|
|
||||||
`Your fleet has arrived at ${this.data.destination instanceof SystemManager ? `${this.data.destination.data.name} system` : `planet ${this.data.destination.name}`}.\n
|
|
||||||
Ships: ${this.data.ships.map(ship => `${ship.amount} ${ship.id}`).join(', ')}\n
|
|
||||||
Cargo delivered: ${this.data.cargo.length > 0 ? this.data.cargo.map(cargo => `${cargo.amount} ${cargo.id}`).join(', ') : 'None'}\n
|
|
||||||
Ships will stay at the destination.`
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +103,7 @@ export default class FleetManager {
|
||||||
|
|
||||||
async initiateReturn() {
|
async initiateReturn() {
|
||||||
this.data.returning = true;
|
this.data.returning = true;
|
||||||
this.data.departureTime = new Date(this.data.arrivalTime);
|
this.data.departureTime = new Date();
|
||||||
this.data.arrivalTime = new Date(this.data.departureTime.getTime() + 1000 * 30);
|
this.data.arrivalTime = new Date(this.data.departureTime.getTime() + 1000 * 30);
|
||||||
await this.sync();
|
await this.sync();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
import { ObjectId } from "mongodb";
|
|
||||||
import { Mails } from "./mongodb"
|
|
||||||
import DBMail from "../../types/db/DBMail";
|
|
||||||
|
|
||||||
export const getMailById = async (id: ObjectId) => {
|
|
||||||
return await (await Mails()).findOne({
|
|
||||||
_id: id
|
|
||||||
}) as DBMail;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getMailsByTo = async (to: ObjectId) => {
|
|
||||||
return await (await Mails()).find({
|
|
||||||
to
|
|
||||||
}).toArray() as DBMail[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const checkForUnreadMails = async (to: ObjectId) => {
|
|
||||||
return (await (await Mails()).find({
|
|
||||||
to,
|
|
||||||
read: false
|
|
||||||
}).toArray()).length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const sendMail = async (from: ObjectId | null, to: ObjectId, date: Date, subject: string, body: string) => {
|
|
||||||
await (await Mails()).insertOne({
|
|
||||||
from,
|
|
||||||
to,
|
|
||||||
date,
|
|
||||||
subject,
|
|
||||||
body,
|
|
||||||
read: false
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -91,9 +91,4 @@ export const Lang = async (language = "en") => {
|
||||||
await db.collection('research'),
|
await db.collection('research'),
|
||||||
await db.collection('structures')
|
await db.collection('structures')
|
||||||
]
|
]
|
||||||
}
|
|
||||||
|
|
||||||
export const Mails = async() => {
|
|
||||||
const db = await getDB();
|
|
||||||
return db.collection('mails');
|
|
||||||
}
|
}
|
|
@ -60,7 +60,7 @@ export const POST: APIRoute = async({ request }) => {
|
||||||
const building = new Building(userPlanet.buildings, buildingObj, 1);
|
const building = new Building(userPlanet.buildings, buildingObj, 1);
|
||||||
|
|
||||||
const requirements = await building.checkRequirements();
|
const requirements = await building.checkRequirements();
|
||||||
const resources = await building.checkRequiredResources((userPlanet.buildings.getBuildingById(buildingId)?.level ?? 0));
|
const resources = await building.checkRequiredResources((userPlanet.buildings.getBuildingById(buildingId)?.level ?? 0) + 1);
|
||||||
|
|
||||||
if(!requirements.canBuild || !resources) {
|
if(!requirements.canBuild || !resources) {
|
||||||
return new Response(
|
return new Response(
|
||||||
|
@ -75,7 +75,7 @@ export const POST: APIRoute = async({ request }) => {
|
||||||
const resourcesDiff = await userPlanet.resources.getDifference(building.data.requirements.resources.map(res => {
|
const resourcesDiff = await userPlanet.resources.getDifference(building.data.requirements.resources.map(res => {
|
||||||
return {
|
return {
|
||||||
id: res.id,
|
id: res.id,
|
||||||
amount: Math.pow(building.data.multiplier, (userPlanet.buildings.getBuildingById(buildingId)?.level ?? 0)) * res.amount
|
amount: Math.pow(building.data.multiplier, (userPlanet.buildings.getBuildingById(buildingId)?.level ?? 0) + 1) * res.amount
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ export const POST: APIRoute = async({ request }) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
userPlanet.resources.setAmount(resourcesAfter.map(res => { return { id: res.id, amount: res.amount } }));
|
userPlanet.resources.updateAmount(resourcesAfter.map(res => { return { id: res.id, amount: res.amount } }));
|
||||||
userPlanet.buildings.addBuilding(building);
|
userPlanet.buildings.addBuilding(building);
|
||||||
|
|
||||||
await userPlanet.buildings.sync();
|
await userPlanet.buildings.sync();
|
||||||
|
|
|
@ -117,7 +117,6 @@ const buildingsByCategory = buildingsList.reduce((acc: { [key: string]: Array<DB
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 101;
|
z-index: 101;
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
@ -145,9 +144,9 @@ h1 {
|
||||||
if(!modalDiv) return;
|
if(!modalDiv) return;
|
||||||
modalDiv.style.display = 'block';
|
modalDiv.style.display = 'block';
|
||||||
|
|
||||||
const reqResources = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.resources ?? [];
|
const reqResources = modalSet[el.parentElement.parentElement.dataset.id]?.resources ?? [];
|
||||||
const reqBuildings = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.buildings ?? [];
|
const reqBuildings = modalSet[el.parentElement.parentElement.dataset.id]?.buildings ?? [];
|
||||||
const reqResearch = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.research ?? [];
|
const reqResearch = modalSet[el.parentElement.parentElement.dataset.id]?.research ?? [];
|
||||||
|
|
||||||
modalResources.innerHTML = reqResources.length === 0 ? "None" : reqResources.map(resource => {
|
modalResources.innerHTML = reqResources.length === 0 ? "None" : reqResources.map(resource => {
|
||||||
return `${lang['resources'].find(r => r.id === resource.id).name}: ${resource.amount}`;
|
return `${lang['resources'].find(r => r.id === resource.id).name}: ${resource.amount}`;
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
---
|
|
||||||
import LoggedIn from '../../layouts/LoggedIn.astro';
|
|
||||||
import locationManager from '../../lib/classes/managers/LocationManager';
|
|
||||||
import { Planet } from '../../lib/classes/managers/PlanetManager';
|
|
||||||
import SystemManager from '../../lib/classes/managers/SystemManager';
|
|
||||||
import { getMailsByTo } from '../../lib/db/mails';
|
|
||||||
|
|
||||||
const { user, token, lang } = Astro.locals;
|
|
||||||
const active: SystemManager | Planet = Astro.locals.active;
|
|
||||||
|
|
||||||
const mails = (await getMailsByTo(user.id)).sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
||||||
---
|
|
||||||
<LoggedIn id="mail" title="Mail">
|
|
||||||
{mails.map(mail => <div class="mail-card">
|
|
||||||
<h1>{!mail.read && "(NEW) "}{mail.subject} | from: {mail.from === null ? "SYSTEM" : locationManager.getUser(mail.from)?.username ?? "Unknown"}</h1>
|
|
||||||
<p>{mail.date.toLocaleString()}</p>
|
|
||||||
<hr />
|
|
||||||
<p style="white-space: pre-line">{mail.body}</p>
|
|
||||||
</div>)}
|
|
||||||
</LoggedIn>
|
|
||||||
<style>
|
|
||||||
.mail-card {
|
|
||||||
background: #333;
|
|
||||||
padding: 1em;
|
|
||||||
margin: 1em;
|
|
||||||
border-radius: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mail-card h1 {
|
|
||||||
color: #fff;
|
|
||||||
font-size: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mail-card p {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -100,7 +100,6 @@ for(const research of researchList) {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 101;
|
z-index: 101;
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script define:vars={{ modalSet, lang }}>
|
<script define:vars={{ modalSet, lang }}>
|
||||||
|
@ -117,9 +116,9 @@ for(const research of researchList) {
|
||||||
|
|
||||||
console.log(modalSet)
|
console.log(modalSet)
|
||||||
|
|
||||||
const reqResources = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.resources ?? [];
|
const reqResources = modalSet[el.parentElement.parentElement.dataset.id]?.resources ?? [];
|
||||||
const reqBuildings = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.buildings ?? [];
|
const reqBuildings = modalSet[el.parentElement.parentElement.dataset.id]?.buildings ?? [];
|
||||||
const reqResearch = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.research ?? [];
|
const reqResearch = modalSet[el.parentElement.parentElement.dataset.id]?.research ?? [];
|
||||||
|
|
||||||
modalResources.innerHTML = reqResources.length === 0 ? "None" : reqResources.map(resource => {
|
modalResources.innerHTML = reqResources.length === 0 ? "None" : reqResources.map(resource => {
|
||||||
return `${lang['resources'].find(r => r.id === resource.id).name}: ${resource.amount}`;
|
return `${lang['resources'].find(r => r.id === resource.id).name}: ${resource.amount}`;
|
||||||
|
|
|
@ -6,33 +6,11 @@ import SystemManager from '../../lib/classes/managers/SystemManager';
|
||||||
import { getAllShips } from '../../lib/db/ships';
|
import { getAllShips } from '../../lib/db/ships';
|
||||||
import { getObj } from '../../lib/utils/langDriver';
|
import { getObj } from '../../lib/utils/langDriver';
|
||||||
|
|
||||||
const { token, lang } = Astro.locals;
|
const { lang } = Astro.locals;
|
||||||
const active: SystemManager | Planet = Astro.locals.active;
|
const active: SystemManager | Planet = Astro.locals.active;
|
||||||
|
|
||||||
const ships = await getAllShips();
|
const ships = await getAllShips();
|
||||||
|
|
||||||
if(Astro.request.method === "POST") {
|
|
||||||
const body = await Astro.request.formData();
|
|
||||||
|
|
||||||
const id = body.get("id") as string;
|
|
||||||
const amount = parseInt(body.get("amount") as string ?? "1");
|
|
||||||
|
|
||||||
const request = await (await fetch(Astro.url.origin + '/api/ships/addShip', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization': 'Bearer ' + token
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
planet: active instanceof SystemManager ? active.data._id : active._id,
|
|
||||||
ship: id,
|
|
||||||
amount
|
|
||||||
})
|
|
||||||
})).json();
|
|
||||||
|
|
||||||
console.log(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
const modalSet: { [key: string]: { resources: Array<any>, research: Array<any>, buildings: Array<any> } } = {};
|
const modalSet: { [key: string]: { resources: Array<any>, research: Array<any>, buildings: Array<any> } } = {};
|
||||||
|
|
||||||
for(const ship of ships) {
|
for(const ship of ships) {
|
||||||
|
@ -68,8 +46,7 @@ const planetId = active instanceof SystemManager ? active.data._id : active._id;
|
||||||
description={getObj(lang, "ships", ship.id).description ?? ""}
|
description={getObj(lang, "ships", ship.id).description ?? ""}
|
||||||
image={`/images/ships/${ship.id}.jpeg`}
|
image={`/images/ships/${ship.id}.jpeg`}
|
||||||
button_type="general"
|
button_type="general"
|
||||||
button_name="nav-build"
|
button_name="nav-build" />
|
||||||
has_amount_input="true" />
|
|
||||||
</>)}
|
</>)}
|
||||||
</div>
|
</div>
|
||||||
</LoggedIn>
|
</LoggedIn>
|
||||||
|
@ -107,7 +84,6 @@ const planetId = active instanceof SystemManager ? active.data._id : active._id;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
z-index: 101;
|
z-index: 101;
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script define:vars={{ modalSet, lang, planetId }}>
|
<script define:vars={{ modalSet, lang, planetId }}>
|
||||||
|
@ -122,9 +98,9 @@ const planetId = active instanceof SystemManager ? active.data._id : active._id;
|
||||||
if(!modalDiv) return;
|
if(!modalDiv) return;
|
||||||
modalDiv.style.display = 'block';
|
modalDiv.style.display = 'block';
|
||||||
|
|
||||||
const reqResources = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.resources ?? [];
|
const reqResources = modalSet[el.parentElement.parentElement.dataset.id]?.resources ?? [];
|
||||||
const reqBuildings = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.buildings ?? [];
|
const reqBuildings = modalSet[el.parentElement.parentElement.dataset.id]?.buildings ?? [];
|
||||||
const reqResearch = modalSet[el.parentElement.parentElement.parentElement.dataset.id]?.research ?? [];
|
const reqResearch = modalSet[el.parentElement.parentElement.dataset.id]?.research ?? [];
|
||||||
|
|
||||||
modalResources.innerHTML = reqResources.length === 0 ? "None" : reqResources.map(resource => {
|
modalResources.innerHTML = reqResources.length === 0 ? "None" : reqResources.map(resource => {
|
||||||
return `${lang['resources'].find(r => r.id === resource.id).name}: ${resource.amount}`;
|
return `${lang['resources'].find(r => r.id === resource.id).name}: ${resource.amount}`;
|
||||||
|
|
|
@ -72,7 +72,7 @@ for(const structure of structureList) {
|
||||||
<div class="structure-list">
|
<div class="structure-list">
|
||||||
{currentSystem.structures.structuresDB.map(structure => (
|
{currentSystem.structures.structuresDB.map(structure => (
|
||||||
<ItemCard
|
<ItemCard
|
||||||
category="megastructures"
|
category="structures"
|
||||||
id={structure.id}
|
id={structure.id}
|
||||||
name={getName(lang, 'structures', structure.id)}
|
name={getName(lang, 'structures', structure.id)}
|
||||||
image={`/images/structures/${structure.id}.jpeg`}
|
image={`/images/structures/${structure.id}.jpeg`}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import { ObjectId } from "mongodb";
|
|
||||||
|
|
||||||
export default interface DBMail {
|
|
||||||
_id: ObjectId;
|
|
||||||
from: ObjectId | null;
|
|
||||||
to: ObjectId;
|
|
||||||
date: Date;
|
|
||||||
subject: string;
|
|
||||||
body: string;
|
|
||||||
read: boolean;
|
|
||||||
}
|
|
Loading…
Reference in New Issue