Skip to content

Commit

Permalink
added number toggle (★ page bottom)
Browse files Browse the repository at this point in the history
fixed buggy pagination string casting
added icon for non-scrollable evilities
updated seal of power and s.o. seal categories and cost
added description toggle to build list
fixed build list category column padding when wrapped
prevented unobtainable evilities from being shown
  • Loading branch information
Cecil Bowen committed Oct 24, 2023
1 parent df2070d commit ac952de
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 27 deletions.
Binary file added public/images/NoScroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const App = () => {
const [builderActive, setBuilderActive] = useState(false);
const [buildEvilities, setBuildEvilities] = useState([]);
const [fixedClass, setFixedClass] = useState("Prinny");
const [showNumbers, setShowNumbers] = useState(false);

const loadBuild = (build, evs) => {
evs = evs || evilities;
Expand Down Expand Up @@ -229,6 +230,7 @@ const App = () => {
}}
building={builderActive}
fixed={fixedClass}
showNumbers={showNumbers}
/>
{builderActive && <BuildList evilities={buildEvilities}
passFixedClass={passFixedClass}
Expand All @@ -239,11 +241,12 @@ const App = () => {

<div>
<small>
<a href="https://github.com/cecilbowen/disgaea-7-evility-search">Source Code</a>&nbsp;
<span onClick={() => setShowNumbers(!showNumbers)} title="Toggle Numbers" style={{ cursor: 'pointer' }}>{showNumbers ? '★' : '☆'}</span> |&nbsp;
<a href="https://github.com/cecilbowen/disgaea-7-evility-search">Source Code</a> |
References:&nbsp;
<a href="https://gamefaqs.gamespot.com/boards/378248-disgaea-7-vows-of-the-virtueless/80587648">one</a>&nbsp;
<a href="https://gamefaqs.gamespot.com/boards/378250-disgaea-7-vows-of-the-virtueless/80592079">two</a>&nbsp;
<a href="https://docs.google.com/spreadsheets/d/14HQrRhglcYtVkY6Uk4-XgqtUVMq6qmBQYtjJ6Ro-_WA/edit#gid=2122935455">three</a>
<a target="_blank" rel="noopener noreferrer" href="https://gamefaqs.gamespot.com/boards/378248-disgaea-7-vows-of-the-virtueless/80587648">one</a>&nbsp;
<a target="_blank" rel="noopener noreferrer" href="https://gamefaqs.gamespot.com/boards/378250-disgaea-7-vows-of-the-virtueless/80592079">two</a>&nbsp;
<a target="_blank" rel="noopener noreferrer" href="https://docs.google.com/spreadsheets/d/14HQrRhglcYtVkY6Uk4-XgqtUVMq6qmBQYtjJ6Ro-_WA/edit#gid=2122935455">three</a>
</small>
</div>
</div>
Expand Down
24 changes: 19 additions & 5 deletions src/components/BuildList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import ListItemText from '@mui/material/ListItemText';
import IconButton from '@mui/material/IconButton';
import DeleteIcon from '@mui/icons-material/Delete';
import DeleteSweepIcon from '@mui/icons-material/DeleteSweep';
import SwapIcon from '@mui/icons-material/SwapHoriz';

const StyledTableCell = styled(TableCell)(({ theme }) => ({
[`&.${tableCellClasses.head}`]: {
Expand Down Expand Up @@ -79,6 +80,7 @@ const BuildList = ({ evilities, removeEvilityFromBuild, passFixedClass, loadBuil
const [modalOpenL, setModalOpenL] = React.useState(false);
const [stashedBuilds, setStashedBuilds] = useState([]);
const [buildToLoad, setBuildToLoad] = useState();
const [showDesc, setShowDesc] = useState(false);

const handleModalOpen = () => setModalOpen(true);
const handleModalClose = () => setModalOpen(false);
Expand Down Expand Up @@ -369,7 +371,7 @@ const BuildList = ({ evilities, removeEvilityFromBuild, passFixedClass, loadBuil
</Grid>
</Grid>
<Grid item>
<TableContainer component={Paper} sx={{ maxHeight: "53.7vh", overflowY: "auto" }}>
<TableContainer component={Paper} sx={{ maxHeight: "53.7vh", overflowY: "auto", overflowX: 'hidden' }}>
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
Expand All @@ -383,19 +385,31 @@ const BuildList = ({ evilities, removeEvilityFromBuild, passFixedClass, loadBuil
<StyledTableCell align="left" sx={{ width: '12em' }}>
Evility
</StyledTableCell>
<StyledTableCell align="left">Type</StyledTableCell>
<StyledTableCell align="left" sx={{ display: 'flex' }}
title={"Toggle between Type/Description"}
onClick={() => setShowDesc(!showDesc)}>
{showDesc ? "Description" : "Type"}
<SwapIcon sx={{ marginLeft: '4px', cursor: 'pointer' }} />
</StyledTableCell>
<StyledTableCell align="center" sx={{ width: '6em' }}>Cost</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
{evilities.map(evility => {
const type = evility.unique ? "Unique" : "Generic";
let nameStyle = { ...style, width: '12em', position: 'relative' };
let rowStyle = { cursor: 'pointer' };
let colStyle = {};
const descStyle = { overflowX: 'hidden', textOverflow: 'ellipsis', maxWidth: '0px', whiteSpace: 'nowrap' };
if (evility.dlc) {
nameStyle = { ...nameStyle, ...dlcStyle };
}
if (evility.unique) {
rowStyle = { ...rowStyle, backgroundColor: '#8000802e !important' };
colStyle = { ...colStyle, ...uniqueStyle };
}
if (showDesc) {
colStyle = { ...descStyle };
}

return <StyledTableRow
Expand All @@ -406,15 +420,15 @@ const BuildList = ({ evilities, removeEvilityFromBuild, passFixedClass, loadBuil
sx={rowStyle}
>
<StyledTableCell align="center" title={evility.category}
sx={{ display: 'flex', alignItems: 'center', justifyContent: "center" }}>
sx={{ display: 'table-cell', verticalAlign: 'middle', paddingBottom: '0px' }}>
<img src={`images/evility_categories/${evility.category}.png`}
style={{ objectFit: 'contain' }} />
</StyledTableCell>
<StyledTableCell align="left" sx={nameStyle}>{evility.name}{evility.fixed && <LockIcon
sx={{ width: '15px', verticalAlign: 'middle', marginTop: '-2px',
color: 'blue', marginLeft: '4px' }} />}</StyledTableCell>
<StyledTableCell align="left" sx={evility.unique && uniqueStyle}>
{evility.unique ? "Unique" : "Generic"}
<StyledTableCell align="left" sx={colStyle} title={evility.description}>
{showDesc ? evility.description : type}
</StyledTableCell>
<StyledTableCell align="center" sx={{ width: '6em' }}>{evility.cost}</StyledTableCell>
</StyledTableRow>;
Expand Down
45 changes: 40 additions & 5 deletions src/components/EvilityTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ const PaginationBox = styled(Box)`

const EvilityTable = ({
evilities, textFilter, filters, searchCriteria,
addEvilityToBuild, building, fixed
addEvilityToBuild, building, fixed,
showNumbers
}) => {
const [filteredEvilities, setFilteredEvilities] = useState([]);
const [noTextFilterEvilities, setNoTextFilterEvilities] = useState([]);
const pageOptions = [
{ label: '30', value: 30 },
{ label: '50', value: 50 },
Expand All @@ -59,7 +61,10 @@ const EvilityTable = ({
useEffect(() => {
const rpp = localStorage.getItem('d7-rpp') || rowsPerPage;
if (rpp !== rowsPerPage) {
setRowsPerPage(rpp);
const int = parseInt(rpp, 10);
if (!isNaN(int)) {
setRowsPerPage(int);
}
}
}, []);

Expand All @@ -79,9 +84,11 @@ const EvilityTable = ({
(filters.enemy || !x.enemyOnly) &&
(filters.baseGame || x.dlc) &&
(filters.dlc || !x.dlc) &&
filters.categories.includes(x.category);
filters.categories.includes(x.category) &&
!x.notInGame;
});
}
setNoTextFilterEvilities(tempFilteredEvilities);

if (textFilter && textFilter.length > 0) {
tempFilteredEvilities = tempFilteredEvilities.filter(x => {
Expand Down Expand Up @@ -123,6 +130,22 @@ const EvilityTable = ({
localStorage.setItem('d7-rpp', rpp);
};

// returns the list number of the evility, where the
// list is either the list of all generic or all unique evilities
// in-game (with appropriate filters applied)
const getListNumber = evility => {
const list = [...noTextFilterEvilities].filter(x => evility.unique === x.unique && !x.fixed &&
!x.enemyOnly);
for (let i = 0; i < list.length; i++) {
const ev = list[i];
if (ev.id === evility.id) {
return i + 1;
}
}

return 0;
};

const style = {
fontWeight: 'bold'
};
Expand All @@ -137,12 +160,17 @@ const EvilityTable = ({

const flex = building ? '1 0 55%' : '1';

const numberExplanation = "Number displayed in your evility list (assuming you have all evilities unlocked on the character)";

return (
<Paper id="main1" style={{ margin: "1em", flex, order: '1', overflow: 'auto', height: 'fit-content' }}>
<TableContainer sx={{ maxHeight: "69vh", overflowY: "auto", width: '100%' }}>
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
{showNumbers && <StyledTableCell align="center" sx={{ width: '1em' }} title={numberExplanation}>
No.
</StyledTableCell>}
<StyledTableCell sx={{ width: '12em' }}>Name</StyledTableCell>
<StyledTableCell align="center">Category</StyledTableCell>
<StyledTableCell align="left">Description</StyledTableCell>
Expand All @@ -154,6 +182,7 @@ const EvilityTable = ({
<TableBody>
{(rowsPerPage > 0 ? filteredEvilities.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) : filteredEvilities)
.map(evility => {
const listNumber = getListNumber(evility);
let nameStyle = { ...style };
let rowStyle = {};
if (evility.enemyOnly) {
Expand Down Expand Up @@ -192,10 +221,15 @@ const EvilityTable = ({
sx={rowStyle}
onClick={() => !cantAdd && addEvilityToBuild(evility)}
>
{showNumbers && <StyledTableCell align="center">
{listNumber || '-'}
</StyledTableCell>}
<StyledTableCell component="th" scope="row" sx={ nameStyle } title={title}>
{evility.name}{evility.fixed && <LockIcon
sx={{ width: '15px', cursor: 'pointer', verticalAlign: 'middle', marginTop: '-2px',
color: 'blue', marginLeft: '4px' }} />}
color: 'blue', marginLeft: '4px' }} />}{evility.notScrollable && <img
style={{ transform: 'translateY(3px)', marginLeft: '4px', cursor: 'pointer', width: '15px' }}
title={"Can't be turned into a scroll"} src={`images/NoScroll.png`} />}
</StyledTableCell>
<StyledTableCell align="center" sx={{ lineHeight: 0 }}><img title={evility.category}
src={`images/evility_categories/${evility.category || "None"}.png`} />
Expand Down Expand Up @@ -242,6 +276,7 @@ EvilityTable.propTypes = {
filters: PropTypes.object,
searchCriteria: PropTypes.string,
building: PropTypes.bool,
fixed: PropTypes.string
fixed: PropTypes.string,
showNumbers: PropTypes.bool
};
export default EvilityTable;
32 changes: 20 additions & 12 deletions src/data/evilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@
{
"id": "EVILITY_ID_SHIKI_ZESSHOSAI_FIX_1",
"name": "Shiki",
"description": "When an ally dies, revive with 20% to stats (1 time max for each unit).",
"description": "When an ally dies, revive the ally with stats increased by 20% (1 time max for each unit).",
"notes": "Even once Shiki Zesshosai dies, enemies still have the revive saved up...",
"unique": true,
"cost": 0,
Expand Down Expand Up @@ -4671,7 +4671,8 @@
"enemyOnly": false,
"unlock": "???",
"category": "Stat Boosting",
"dlc": false
"dlc": false,
"notInGame": true
},
{
"id": "EVILITY_ID_GENERIC_0013",
Expand Down Expand Up @@ -6159,7 +6160,8 @@
"enemyOnly": false,
"unlock": "???",
"category": "None",
"dlc": false
"dlc": false,
"notInGame": true
},
{
"id": "EVILITY_ID_GENERIC_0128",
Expand Down Expand Up @@ -6855,7 +6857,8 @@
"enemyOnly": false,
"unlock": "???",
"category": "None",
"dlc": false
"dlc": false,
"notInGame": true
},
{
"id": "EVILITY_ID_GENERIC_0172",
Expand All @@ -6867,7 +6870,8 @@
"enemyOnly": false,
"unlock": "???",
"category": "None",
"dlc": false
"dlc": false,
"notInGame": true
},
{
"id": "EVILITY_ID_GENERIC_0183",
Expand Down Expand Up @@ -7311,7 +7315,8 @@
"enemyOnly": false,
"unlock": "???",
"category": "None",
"dlc": false
"dlc": false,
"notInGame": true
},
{
"id": "EVILITY_ID_ENEMY_ONLY_0001",
Expand Down Expand Up @@ -7719,7 +7724,8 @@
"enemyOnly": false,
"unlock": "Evility Scholars after 300 battles",
"category": "Miscellaneous",
"dlc": false
"dlc": false,
"notScrollable": true
},
{
"id": "EVILITY_ID_VICE_COMPLETE_02",
Expand All @@ -7730,20 +7736,22 @@
"cost": 1,
"enemyOnly": false,
"unlock": "Defeat Carnage 15 boss",
"category": "None",
"dlc": false
"category": "Miscellaneous",
"dlc": false,
"notScrollable": true
},
{
"id": "EVILITY_ID_CUSTOM_9",
"name": "S.O. Seal",
"description": "Multiply own Seal of Power stat gain effect by 10.",
"notes": "",
"unique": false,
"cost": 0,
"cost": 1,
"enemyOnly": false,
"unlock": "Defeat Carnage Baal",
"category": "None",
"dlc": false
"category": "Miscellaneous",
"dlc": false,
"notScrollable": true
},
{
"id": "EVILITY_ID_ENEMY_ONLY_0035",
Expand Down
2 changes: 1 addition & 1 deletion src/data/evilities_dlc.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
{
"id": "EVILITY_ID_DLC_AXEL_FIX_1",
"name": "Obvious Tendency",
"description": "Increases stats by% per female unit on the map.",
"description": "Increases stats by 5% per female unit on the map.",
"notes": "",
"unique": true,
"cost": 0,
Expand Down

0 comments on commit ac952de

Please sign in to comment.