unique, loyal, legendary

This commit is contained in:
Daniel 2017-11-24 17:26:35 -05:00
parent fb7ac94ab6
commit 18a577ef99
2 changed files with 47 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -12,21 +12,25 @@ import loki from 'lokijs';
@inject((stores, props, context) => props) @observer
export default class SearchForm extends React.Component {
type = "";
swamp = "or";
stones = {};
tribes = {};
elements = {};
rarity = {};
sets = {};
gender = {};
mc = {};
constructor() {
super();
this.reset();
this.filter = new loki("filter.db");
}
reset = () => {
this.type = "";
this.swamp = "or";
this.stones = {};
this.tribes = {};
this.elements = {};
this.rarity = {};
this.sets = {};
this.gender = {};
this.mc = {};
};
render() {
let setsInput = [];
@ -84,6 +88,12 @@ export default class SearchForm extends React.Component {
<label>Max Mugic Counters: <input type="text" style={{width: '20px'}} ref={(input) => this.mc.max = input} /></label>
</div>
<br />
<div>
<label><input type="checkbox" ref={(input) => this.stones.unique = input}/>Unique</label>&nbsp;
<label><input type="checkbox" ref={(input) => this.stones.loyal = input}/>loyal</label>&nbsp;
<label><input type="checkbox" ref={(input) => this.stones.legendary = input}/>Male</label>
</div>
<br />
<div>
<label><input type="checkbox" ref={(input) => this.gender.Ambiguous = input}/>Ambiguous</label>&nbsp;
<label><input type="checkbox" ref={(input) => this.gender.Female = input}/>Female</label>&nbsp;
@ -96,7 +106,8 @@ export default class SearchForm extends React.Component {
<label>"Show all cards":<input type="checkbox" ref={(input) => this.stones.allCards = input}/></label>
</p>
<br />
<input type="submit" value="Search" />&nbsp;&nbsp;<input type="button" disabled value="Reset" />
<input type="submit" value="Search" />&nbsp;&nbsp;
<input type="button" value="Reset" disabled onClick={this.reset} />
</form>
</div>
);
@ -240,6 +251,21 @@ export default class SearchForm extends React.Component {
creatureResults = creatureResults.find({'gsx$mugicability': {'$lte': this.mc.max.value}});
}
if (this.stones.unique.checked) {
creatureResults = creatureResults.find({'gsx$unique': {'$gt': 0}});
attackResults = attackResults.find({'gsx$unique': {'$gt': 0}});
}
if (this.stones.loyal.checked) {
creatureResults = creatureResults.find({'gsx$loyal': {'$gt': 0}});
attackResults = attackResults.find({'gsx$loyal': {'$gt': 0}});
}
if (this.stones.legendary.checked) {
creatureResults = creatureResults.find({'gsx$legendary': {'$gt': 0}});
attackResults = attackResults.find({'gsx$legendary': {'$gt': 0}});
}
// Merge data
if (!this.type || this.type=="Creature") {
let temp = creatureResults.data()