updated to work with condensed spreadsheet data

This commit is contained in:
Daniel
2017-12-18 15:39:55 -05:00
parent 17846e91c4
commit 3ab368bb82
6 changed files with 54 additions and 50 deletions

File diff suppressed because one or more lines are too long

View File

@@ -63,6 +63,10 @@ class API {
}
}
get tribes() {
return ["Danian", "Generic", "Mipedian", "OverWorld", "UnderWorld"];
}
// For the conversion of shorthand in database
get sets() {
return {
@@ -149,38 +153,38 @@ class CollectionDB {
});
}
setupAttacks(tribe="Generic") {
this.setup(this.api.urls.Attacks[tribe], "Attack", (data) => {
setupAttacks(type="portal") {
this.setup(this.api.urls.Attacks[type], "Attack", (data) => {
this.attacks.insert(data);
this.built.push("attacks_"+tribe);
this.built.push("attacks_"+type);
});
}
setupBattlegear(tribe="Generic") {
this.setup(this.api.urls.Battlegear[tribe], "Battlegear", (data) => {
setupBattlegear(type="portal") {
this.setup(this.api.urls.Battlegear[type], "Battlegear", (data) => {
this.battlegear.insert(data);
this.built.push("battlegear_"+tribe);
this.built.push("battlegear_"+type);
});
}
setupCreatures(tribe="Generic") {
this.setup(this.api.urls.Creatures[tribe], "Creature", (data) => {
setupCreatures(type="portal") {
this.setup(this.api.urls.Creatures[type], "Creature", (data) => {
this.creatures.insert(data);
this.built.push("creatures_"+tribe);
this.built.push("creatures_"+type);
});
}
setupLocations(tribe="Generic") {
this.setup(this.api.urls.Locations[tribe], "Location", (data) => {
setupLocations(type="portal") {
this.setup(this.api.urls.Locations[type], "Location", (data) => {
this.locations.insert(data);
this.built.push("locations_"+tribe);
this.built.push("locations_"+type);
});
}
setupMugic(tribe="Generic") {
this.setup(this.api.urls.Mugic[tribe], "Mugic", (data) => {
setupMugic(type="portal") {
this.setup(this.api.urls.Mugic[type], "Mugic", (data) => {
this.mugic.insert(data);
this.built.push("mugic_"+tribe);
this.built.push("mugic_"+type);
});
}
}

View File

@@ -36,7 +36,7 @@ export default class Creatures extends React.Component {
// If there isn't a supported tribe,
// Displays list of tribes
if (!store.urls.Creatures.hasOwnProperty(tribe)) {
if (!store.tribes.includes(tribe)) {
return(
<div>
<Interactive as={Link} {...s.link}
@@ -58,13 +58,13 @@ export default class Creatures extends React.Component {
);
}
if (!store.cards.built.includes("creatures_Cards")) {
store.cards.setupCreatures("Cards");
if (!store.cards.built.includes("creatures_cards")) {
store.cards.setupCreatures("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("creatures_"+tribe)) {
store.portal.setupCreatures(tribe);
if (!store.portal.built.includes("creatures_portal")) {
store.portal.setupCreatures("portal");
return (<span>Loading...</span>);
}
@@ -74,7 +74,7 @@ export default class Creatures extends React.Component {
return (
<div key={i}>
<Interactive as={Link} {...s.link}
to={'/portal/Creatures/'+tribe+'/'+creature.gsx$name}
to={'/portal/'+tribe+'/Creatures/'+creature.gsx$name}
>
<span>{creature.gsx$name}</span><br />
<img className="thumb" src={store.base_image + card_data.gsx$thumb}></img>

View File

@@ -36,7 +36,7 @@ export default class Mugic extends React.Component {
// If there isn't a supported tribe,
// Displays list of tribes
if (!store.urls.Mugic.hasOwnProperty(tribe)) {
if (!store.tribes.includes(tribe)) {
return(
<div>
<Interactive as={Link} {...s.link}
@@ -62,13 +62,13 @@ export default class Mugic extends React.Component {
);
}
if (!store.cards.built.includes("mugic_Cards")) {
store.cards.setupMugic("Cards");
if (!store.cards.built.includes("mugic_cards")) {
store.cards.setupMugic("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("mugic_"+tribe)) {
store.portal.setupMugic(tribe);
if (!store.portal.built.includes("mugic_portal")) {
store.portal.setupMugic("portal");
return (<span>Loading...</span>);
}
@@ -78,7 +78,7 @@ export default class Mugic extends React.Component {
return (
<div key={i}>
<Interactive as={Link} {...s.link}
to={'/portal/Mugic/'+tribe+'/'+single_mugic.gsx$name}
to={'/portal/'+tribe+'/Mugic/'+single_mugic.gsx$name}
>
<span>{single_mugic.gsx$name}</span><br />
{/* TODO <img className="thumb" src={store.base_image + card_data.gsx$thumb}></img> */}

View File

@@ -38,17 +38,17 @@ export default class SingleCreature extends React.Component {
return (<span>Loading...</span>);
}
if (!store.urls.Creatures.hasOwnProperty(tribe)) {
if (!store.tribes.includes(tribe)) {
return (<span>Invalid Tribe: {tribe}</span>);
}
if (!store.cards.built.includes("creatures_Cards")) {
store.cards.setupCreatures("Cards");
if (!store.cards.built.includes("creatures_cards")) {
store.cards.setupCreatures("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("creatures_"+tribe)) {
store.portal.setupCreatures(tribe);
if (!store.portal.built.includes("creatures_portal")) {
store.portal.setupCreatures("portal");
return (<span>Loading...</span>);
}

View File

@@ -39,17 +39,17 @@ export default class SingleMugic extends React.Component {
return (<span>Loading...</span>);
}
if (!store.urls.Mugic.hasOwnProperty(tribe)) {
if (!store.tribes.includes(tribe)) {
return (<span>Invalid Tribe: {tribe}</span>);
}
if (!store.cards.built.includes("mugic_Cards")) {
store.cards.setupMugic("Cards");
if (!store.cards.built.includes("mugic_cards")) {
store.cards.setupMugic("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("mugic_"+tribe)) {
store.portal.setupMugic(tribe);
if (!store.portal.built.includes("mugic_portal")) {
store.portal.setupMugic("portal");
return (<span>Loading...</span>);
}