Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/item sources #4

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/assets/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@
"agility": 2,
"intelligence": 0,
"defense": 4,
"sources": "Bleep, Perry's Shop",
"sources": ["Bleep", "Perry's Shop"],
"description": "Tackle your problems head first!",
"nicknames": "Horns",
"traits": "",
Expand Down
1 change: 1 addition & 0 deletions src/components/HatTraits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import React from "react";
4 changes: 2 additions & 2 deletions src/components/StatMixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export default function CombosTable() {

React.useEffect(() => {
setUnused(MAX_TOTAL_VAL - (str + vit + agi + int));
setStam(200 + 4 * (int - 1) + lvl - 1);
setHp(200 + 4 * (vit - 1) + lvl - 1);
setStam(265 + 5 * (int - 1) + lvl - 1);
setHp(303 + 4 * (vit - 1) + lvl - 1);
}, [str, vit, agi, int]);

React.useEffect(() => {
Expand Down
16 changes: 15 additions & 1 deletion src/pages/Hats.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const getColumns = () => {
lookup: getRarityLookup(),
customSort: (a, b) => a.rarity - b.rarity,
},
{ title: 'Sources', field: 'sources' },
{ title: 'Sources', field: 'sources', render: (rowData) => renderSources(rowData.sources) },
{ title: 'Strength', field: 'strength', type: 'numeric', render: (rowData) => render(rowData.strength) },
{ title: 'Vitality', field: 'vitality', type: 'numeric', render: (rowData) => render(rowData.vitality) },
{ title: 'Agility', field: 'agility', type: 'numeric', render: (rowData) => render(rowData.agility) },
Expand All @@ -44,6 +44,20 @@ const render = (dataPoint) => {
return dataPoint === -1 ? '?' : dataPoint;
};

const renderSources = (dataPoint) => {

if (typeof dataPoint !== "array")
return dataPoint;

let first = true;

dataPoint.map(source => {
let comma = first ? "" : ", ";
first = false;
return comma + source;
})
};

const getRarityLookup = () => {
return {
0: 'Unobtainable',
Expand Down