get ammo and gear tables working
This commit is contained in:
1 parent
49dec31761
commit
9298ebcd3e
23 files changed
+928
-391
No files matched your search
+36
-28
@@ -1,29 +1,30 @@
|
||||
import { Health } from "./health";
|
||||
|
||||
const baseUrl = typeof window !== 'undefined'
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || 'http://localhost:5173' // Fallback for your server env
|
||||
const baseUrl =
|
||||
typeof window !== "undefined"
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || "http://localhost:5173"; // Fallback for your server env
|
||||
|
||||
const st = await fetch(`${baseUrl}/characters/collateral/stats.json`)
|
||||
.then(r => r.json());
|
||||
const st = await fetch(`${baseUrl}/characters/collateral/stats.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
const sk = await
|
||||
fetch(`${baseUrl}/characters/collateral/skills.json`)
|
||||
.then(r => r.json());
|
||||
const sk = await fetch(`${baseUrl}/characters/collateral/skills.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
const dt = await
|
||||
fetch(`${baseUrl}/characters/collateral/details.json`)
|
||||
.then(r => r.json());
|
||||
|
||||
function RockerRole({rank}) {
|
||||
const dt = await fetch(`${baseUrl}/characters/collateral/details.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
function RockerRole({ rank }) {
|
||||
const topDiv = {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
marginTop: "10px",
|
||||
paddingTop: "10px",
|
||||
borderTop: "1px solid var(--color-border-default)"
|
||||
}
|
||||
borderTop: "1px solid var(--color-border-default)",
|
||||
};
|
||||
|
||||
if (rank > 0) {
|
||||
return (
|
||||
@@ -34,18 +35,17 @@ function RockerRole({rank}) {
|
||||
</main>
|
||||
);
|
||||
}
|
||||
return (<main />);
|
||||
return <main />;
|
||||
}
|
||||
|
||||
function TechRole({rank, fabrication, upgrade, field}) {
|
||||
|
||||
function TechRole({ rank, fabrication, upgrade, field }) {
|
||||
const topDiv = {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
marginTop: "10px",
|
||||
paddingTop: "10px",
|
||||
borderTop: "1px solid var(--color-border-default)"
|
||||
}
|
||||
borderTop: "1px solid var(--color-border-default)",
|
||||
};
|
||||
|
||||
if (rank > 0) {
|
||||
return (
|
||||
@@ -59,30 +59,38 @@ function TechRole({rank, fabrication, upgrade, field}) {
|
||||
</main>
|
||||
);
|
||||
}
|
||||
return (<main />);
|
||||
return <main />;
|
||||
}
|
||||
|
||||
export function Details() {
|
||||
return (
|
||||
<main style={{display: "flex", flexDirection:"column"}}>
|
||||
<main style={{ display: "flex", flexDirection: "column" }}>
|
||||
<div className="cyber-card">
|
||||
<div className="cyber-card__body flex flex-col">
|
||||
<div className="flex">
|
||||
<img style={{ width: "100%" }} src={`${baseUrl}/characters/collateral/portrait.jpg`}></img>
|
||||
<TechRole rank={dt.role_one_rank} fabrication={dt.fabrication_exp} upgrade={dt.upgrade_exp} field={dt.field_exp}/>
|
||||
<img
|
||||
style={{ width: "100%" }}
|
||||
src={`${baseUrl}/characters/collateral/portrait.jpg`}
|
||||
></img>
|
||||
<TechRole
|
||||
rank={dt.role_one_rank}
|
||||
fabrication={dt.fabrication_exp}
|
||||
upgrade={dt.upgrade_exp}
|
||||
field={dt.field_exp}
|
||||
/>
|
||||
<RockerRole rank={dt.role_two_rank} />
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span style={{flexGrow:"1"}}/>
|
||||
<span style={{ flexGrow: "1" }} />
|
||||
|
||||
<div className="cyber-card" style={{marginTop: "20px", flexGrow:1}}>
|
||||
<div className="cyber-card" style={{ marginTop: "20px", flexGrow: 1 }}>
|
||||
<div className="cyber-card__body">
|
||||
<Health />
|
||||
</div>
|
||||
</div>
|
||||
</main >
|
||||
)
|
||||
</main>
|
||||
);
|
||||
}
|
||||
+17
-14
@@ -1,27 +1,30 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
const baseUrl = typeof window !== 'undefined'
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || 'http://localhost:5173'; // Fallback for your server env
|
||||
const baseUrl =
|
||||
typeof window !== "undefined"
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || "http://localhost:5173"; // Fallback for your server env
|
||||
|
||||
const st = await fetch(`${baseUrl}/characters/collateral/stats.json`)
|
||||
.then(r => r.json());
|
||||
const st = await fetch(`${baseUrl}/characters/collateral/stats.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
const sk = await
|
||||
fetch(`${baseUrl}/characters/collateral/skills.json`)
|
||||
.then(r => r.json());
|
||||
const sk = await fetch(`${baseUrl}/characters/collateral/skills.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
export function Health() {
|
||||
|
||||
const [stats, setStats] = useState(st);
|
||||
const [skills, setSkills] = useState(sk)
|
||||
const [skills, setSkills] = useState(sk);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<div style={{display: "flex", flexDirection: "column"}}>
|
||||
<span>Health: {stats.hp} / {stats.maxhp}</span>
|
||||
<div style={{ display: "flex", flexDirection: "column" }}>
|
||||
<span>
|
||||
Health: {stats.hp} / {stats.maxhp}
|
||||
</span>
|
||||
<span>Seriously Wounded: {stats.seriouslywounded}</span>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -5,5 +5,5 @@ export function Humanity() {
|
||||
<span>30</span>
|
||||
<span>44</span>
|
||||
</main>
|
||||
)
|
||||
);
|
||||
}
|
||||
+19
-15
@@ -1,20 +1,21 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
const baseUrl = typeof window !== 'undefined'
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || 'http://localhost:5173'; // Fallback for your server env
|
||||
const baseUrl =
|
||||
typeof window !== "undefined"
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || "http://localhost:5173"; // Fallback for your server env
|
||||
|
||||
const st = await fetch(`${baseUrl}/characters/collateral/stats.json`)
|
||||
.then(r => r.json());
|
||||
const st = await fetch(`${baseUrl}/characters/collateral/stats.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
const sk = await
|
||||
fetch(`${baseUrl}/characters/collateral/skills.json`)
|
||||
.then(r => r.json());
|
||||
const sk = await fetch(`${baseUrl}/characters/collateral/skills.json`).then(
|
||||
(r) => r.json(),
|
||||
);
|
||||
|
||||
export function Stats() {
|
||||
|
||||
const [stats, setStats] = useState(st);
|
||||
const [skills, setSkills] = useState(sk)
|
||||
const [skills, setSkills] = useState(sk);
|
||||
|
||||
return (
|
||||
<main>
|
||||
@@ -52,7 +53,9 @@ export function Stats() {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LUCK</td>
|
||||
<td>{stats.luck}/{stats.luck}</td>
|
||||
<td>
|
||||
{stats.luck}/{stats.luck}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MOVE</td>
|
||||
@@ -64,11 +67,13 @@ export function Stats() {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EMP</td>
|
||||
<td>{stats.emp}/{stats.emp}</td>
|
||||
<td>
|
||||
{stats.emp}/{stats.emp}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</main >
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,5 +136,4 @@ const resources = [
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
|
||||
];
|
||||
@@ -1,14 +1,16 @@
|
||||
import type { ReactElement } from 'react'
|
||||
import type { ReactElement } from "react";
|
||||
|
||||
const baseUrl = typeof window !== 'undefined'
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || 'http://localhost:5173' // Fallback for your server env
|
||||
const baseUrl =
|
||||
typeof window !== "undefined"
|
||||
? window.location.origin
|
||||
: process.env.VITE_VERCEL_URL || "http://localhost:5173"; // Fallback for your server env
|
||||
|
||||
const wandr = await fetch(`${baseUrl}/characters/collateral/weaponsandarmor.json`)
|
||||
.then(r => {
|
||||
console.log(r)
|
||||
return r.json()
|
||||
});
|
||||
const wandr = await fetch(
|
||||
`${baseUrl}/characters/collateral/weaponsandarmor.json`,
|
||||
).then((r) => {
|
||||
console.log(r);
|
||||
return r.json();
|
||||
});
|
||||
|
||||
type DisplayArmor = {
|
||||
displayheadarmor: string;
|
||||
@@ -17,7 +19,7 @@ type DisplayArmor = {
|
||||
displaybodyarmor: number;
|
||||
displaybodyarmorsp: number;
|
||||
displaybodyarmorpenalty: number;
|
||||
}
|
||||
};
|
||||
|
||||
type DisplayWeapon = {
|
||||
name: string;
|
||||
@@ -25,52 +27,58 @@ type DisplayWeapon = {
|
||||
magazine: number;
|
||||
damage: string;
|
||||
rof: number;
|
||||
}
|
||||
};
|
||||
|
||||
function Armor({ armor }: { armor: DisplayArmor }): ReactElement {
|
||||
return (
|
||||
<table className="cyber-table" style={{ fontSize: "10px" }}>
|
||||
<tbody>
|
||||
<tr style={{ lineHeight: 1 }}>
|
||||
<td><b>Head: {armor.displayheadarmor}</b></td>
|
||||
<td>
|
||||
<b>Head: {armor.displayheadarmor}</b>
|
||||
</td>
|
||||
<td>SP: {armor.displayheadarmorsp}</td>
|
||||
<td>AP: {armor.dislpayheadarmorpenalty}</td>
|
||||
</tr>
|
||||
<tr style={{ lineHeight: 1 }}>
|
||||
<td><b>Body: {armor.displaybodyarmor}</b></td>
|
||||
<td>
|
||||
<b>Body: {armor.displaybodyarmor}</b>
|
||||
</td>
|
||||
<td>SP: {armor.displaybodyarmorsp}</td>
|
||||
<td>AP: {armor.displaybodyarmorpenalty}</td>
|
||||
</tr>
|
||||
<tr style={{ lineHeight: 1 }}>
|
||||
<td><b>Shield:</b></td>
|
||||
<td>
|
||||
<b>Shield:</b>
|
||||
</td>
|
||||
<td>HP:</td>
|
||||
<td>AP:</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function Weapons({ weapons }: { weapons: Array<DisplayWeapon> }): ReactElement {
|
||||
const rows: ReactElement[] = weapons.map((weapon, index) => {
|
||||
return (
|
||||
<tr key={index}>
|
||||
<td><b>{weapon.name}</b></td>
|
||||
<td>
|
||||
<b>{weapon.name}</b>
|
||||
</td>
|
||||
<td>MAG: {weapon.magazine}</td>
|
||||
<td>SMG: {weapon.damage}</td>
|
||||
<td>ROF: {weapon.rof}</td>
|
||||
<td>{weapon.features.join(' | ')}</td>
|
||||
<td>{weapon.features.join(" | ")}</td>
|
||||
</tr>
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<table className="cyber-table" style={{ fontSize: "10px" }}>
|
||||
<tbody>
|
||||
{rows}
|
||||
</tbody>
|
||||
<tbody>{rows}</tbody>
|
||||
</table>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const card = {
|
||||
@@ -79,17 +87,24 @@ const card = {
|
||||
paddingLeft: "15px",
|
||||
paddingRight: "15px",
|
||||
paddingBottom: "10px",
|
||||
fontWeight: "10px"
|
||||
}
|
||||
fontWeight: "10px",
|
||||
};
|
||||
|
||||
const header = {
|
||||
marginBottom: "5px",
|
||||
paddingBottom: "15px"
|
||||
}
|
||||
paddingBottom: "15px",
|
||||
};
|
||||
|
||||
export function WeaponsAndArmor() {
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "row", justifyContent:"space-between", height: "230px" }}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
height: "230px",
|
||||
}}
|
||||
>
|
||||
<div className="cyber-card" style={card}>
|
||||
<div className="cyber-card__header" style={header}>
|
||||
<div>Armor</div>
|
||||
@@ -103,5 +118,5 @@ export function WeaponsAndArmor() {
|
||||
<Weapons weapons={wandr.displayweapons} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user