mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-03-21 17:24:14 -05:00
release mugic player; allow "max" discipline filter
This commit is contained in:
parent
4fc583dcf8
commit
a166607bf0
|
|
@ -48,5 +48,9 @@ module.exports = {
|
|||
"react",
|
||||
"import",
|
||||
"react-hooks"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"node_modules",
|
||||
"build"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{1041:function(e,t,n){},1044:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return y}));var a=n(169),r=n.n(a),l=n(82),o=n.n(l),i=n(63),c=n.n(i),s=n(166),u=n.n(s),m=n(167),d=n.n(m),h=n(168),f=n.n(h),b=n(0),E=n.n(b),p=n(83),v=n(55),k=(n(1041),n(3),function(){return E.a.createElement("a",{href:"https://github.com/chaoticbackup",className:"name",rel:"noreferrer noopener",target:"_blank"},"Chaotic Backup Project")}),w=function(e){var t=e.block,n=e.text,a=e.sets;return E.a.createElement("div",{className:"lore"},E.a.createElement("div",{className:"block"},t),n.map((function(e,t){return E.a.createElement("div",{key:t,dangerouslySetInnerHTML:{__html:e}})})),a.map((function(e,t){if(e.text&&e.text.length>0)return E.a.createElement("div",{className:"set",key:t},E.a.createElement("div",{className:"title"},e.title),e.text.map((function(e,t){return E.a.createElement("div",{key:t},e)})))})))},y=function(e){function t(){var e,n;o()(this,t);for(var a=arguments.length,r=new Array(a),l=0;l<a;l++)r[l]=arguments[l];return(n=u()(this,(e=d()(t)).call.apply(e,[this].concat(r)))).state={lore:[]},n}return f()(t,e),c()(t,[{key:"componentDidMount",value:function(){var e=this;fetch("/src/json/starter_lore.json").then((function(e){return e.json()})).then((function(t){e.setState({lore:t})})).catch((function(){e.setState({lore:[{block:"Unable to load lore...",text:[]}]})}))}},{key:"render",value:function(){return E.a.createElement("div",null,E.a.createElement("br",null),E.a.createElement("div",{className:"with-love"},E.a.createElement("div",null,"Welcome to the ",E.a.createElement(k,null),"."),E.a.createElement("span",null,"Built by fans for fans."),E.a.createElement("br",null),E.a.createElement("br",null),E.a.createElement("div",null,"Made with ",E.a.createElement("span",{className:"heart"},"♥")," by",E.a.createElement("br",null),"Danude Sandstorm (Project Lead)",E.a.createElement("br",null),"Chiodosin1 (Database Contributions)",E.a.createElement("br",null),"Afjak and Blitser (Art and Knowledge)"),E.a.createElement("div",null,"Do you like the site? You can donate to support it!"),E.a.createElement("div",{className:"donate"},E.a.createElement(v.e,null)),E.a.createElement("div",{className:"lore"},"We were unsatisfied with the options on how to search for cards. I took the design of the old Chaotic website and added my own modernizations. With an extensive lists of search options in the ",E.a.createElement(p.b,{to:"/collection"},"collection"),", you'll find deck building mores streamlined than ever before. Chaotic is full of rich lore, but unfortunately the best database of official lore disapeared when the ",E.a.createElement(p.b,{to:"/portal"},"Portal to Perim")," disapeared along with the site. You can again explore the official lore and information of Creatures!"),E.a.createElement("br",null),this.state.lore.length>0?this.state.lore.map((function(e,t){return E.a.createElement(w,r()({key:t},e))})):"Loading lore entries..."))}}]),t}(E.a.Component)}}]);
|
||||
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{1069:function(e,t,n){},1072:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return g}));var a=n(169),r=n.n(a),l=n(82),o=n.n(l),c=n(63),i=n.n(c),s=n(167),u=n.n(s),f=n(168),m=n.n(f),d=n(130),h=n.n(d),p=n(0),b=n.n(p),E=n(83),v=n(56);n(1069),n(3);function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var k=function(){return b.a.createElement("a",{href:"https://github.com/chaoticbackup",className:"name",rel:"noreferrer noopener",target:"_blank"},"Chaotic Backup Project")},w=function(e){var t=e.block,n=e.text,a=e.sets;return b.a.createElement("div",{className:"lore"},b.a.createElement("div",{className:"block"},t),n.map((function(e,t){return b.a.createElement("div",{key:t,dangerouslySetInnerHTML:{__html:e}})})),a.map((function(e,t){if(e.text&&e.text.length>0)return b.a.createElement("div",{className:"set",key:t},b.a.createElement("div",{className:"title"},e.title),e.text.map((function(e,t){return b.a.createElement("div",{key:t},e)})))})))},g=function(e){u()(a,e);var t,n=(t=a,function(){var e,n=h()(t);if(y()){var a=h()(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return m()(this,e)});function a(){var e;o()(this,a);for(var t=arguments.length,r=new Array(t),l=0;l<t;l++)r[l]=arguments[l];return(e=n.call.apply(n,[this].concat(r))).state={lore:[]},e}return i()(a,[{key:"componentDidMount",value:function(){var e=this;fetch("/src/json/starter_lore.json").then((function(e){return e.json()})).then((function(t){e.setState({lore:t})})).catch((function(){e.setState({lore:[{block:"Unable to load lore...",text:[]}]})}))}},{key:"render",value:function(){return b.a.createElement("div",null,b.a.createElement("br",null),b.a.createElement("div",{className:"with-love"},b.a.createElement("div",null,"Welcome to the ",b.a.createElement(k,null),"."),b.a.createElement("span",null,"Built by fans for fans."),b.a.createElement("br",null),b.a.createElement("br",null),b.a.createElement("div",null,"Made with ",b.a.createElement("span",{className:"heart"},"♥")," by",b.a.createElement("br",null),"Danude Sandstorm (Project Lead)",b.a.createElement("br",null),"Chiodosin1 (Database Contributions)",b.a.createElement("br",null),"Afjak and Blitser (Art and Knowledge)"),b.a.createElement("div",null,"Do you like the site? You can donate to support it!"),b.a.createElement("div",{className:"donate"},b.a.createElement(v.e,null)),b.a.createElement("div",{className:"lore"},"We were unsatisfied with the options on how to search for cards. I took the design of the old Chaotic website and added my own modernizations. With an extensive lists of search options in the ",b.a.createElement(E.b,{to:"/collection"},"collection"),", you'll find deck building mores streamlined than ever before. Chaotic is full of rich lore, but unfortunately the best database of official lore disapeared when the ",b.a.createElement(E.b,{to:"/portal"},"Portal to Perim")," disapeared along with the site. You can again explore the official lore and information of Creatures!"),b.a.createElement("br",null),this.state.lore.length>0?this.state.lore.map((function(e,t){return b.a.createElement(w,r()({key:t},e))})):"Loading lore entries..."))}}]),a}(b.a.Component)}}]);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -33,7 +33,7 @@ and limitations under the License.
|
|||
* @copyright 2014-2019 Yotam Mann
|
||||
*/
|
||||
|
||||
/** @license React v0.19.0
|
||||
/** @license React v0.19.1
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
|
@ -42,7 +42,7 @@ and limitations under the License.
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.0
|
||||
/** @license React v16.13.1
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
|
@ -51,7 +51,7 @@ and limitations under the License.
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.0
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
|
|
|||
2239
package-lock.json
generated
2239
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
58
package.json
58
package.json
|
|
@ -17,64 +17,64 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@loadable/component": "^5.12.0",
|
||||
"@material-ui/core": "^4.9.5",
|
||||
"@material-ui/core": "^4.9.12",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/styles": "^4.9.0",
|
||||
"@material-ui/styles": "^4.9.10",
|
||||
"lokijs": "^1.5.8",
|
||||
"mobx": "^5.15.4",
|
||||
"mobx-react": "^6.1.8",
|
||||
"mobx-react": "^6.2.2",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.13.0",
|
||||
"react": "^16.13.1",
|
||||
"react-collapsible": "^2.7.0",
|
||||
"react-digit-input": "^1.0.0",
|
||||
"react-dom": "^16.13.0",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-interactive": "^0.9.1",
|
||||
"react-loadable": "^5.5.0",
|
||||
"react-onclickoutside": "^6.9.0",
|
||||
"react-process-string": "^1.2.0",
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"tone": "^14.5.40",
|
||||
"tone": "^14.6.4",
|
||||
"universal-cookie": "^4.0.3",
|
||||
"whatwg-fetch": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.8.4",
|
||||
"@babel/core": "^7.8.7",
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/node": "^7.8.7",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/plugin-proposal-decorators": "^7.8.3",
|
||||
"@babel/plugin-proposal-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-computed-properties": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||
"@babel/polyfill": "^7.8.7",
|
||||
"@babel/preset-env": "^7.8.7",
|
||||
"@babel/preset-flow": "^7.8.3",
|
||||
"@babel/preset-react": "^7.8.3",
|
||||
"@babel/preset-typescript": "^7.8.3",
|
||||
"@babel/register": "^7.8.6",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@types/react": "^16.9.23",
|
||||
"@types/react-dom": "^16.9.5",
|
||||
"@types/react-router-dom": "^5.1.2",
|
||||
"@babel/preset-env": "^7.9.5",
|
||||
"@babel/preset-flow": "^7.9.0",
|
||||
"@babel/preset-react": "^7.9.4",
|
||||
"@babel/preset-typescript": "^7.9.0",
|
||||
"@babel/register": "^7.9.0",
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@types/react": "^16.9.34",
|
||||
"@types/react-dom": "^16.9.7",
|
||||
"@types/react-router-dom": "^5.1.5",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^8.0.5",
|
||||
"css-loader": "^3.4.2",
|
||||
"babel-loader": "^8.1.0",
|
||||
"css-loader": "^3.5.3",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-flowtype": "^4.6.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-react": "^7.18.3",
|
||||
"eslint-plugin-react-hooks": "^2.5.0",
|
||||
"mini-css-extract-plugin": "^0.8.2",
|
||||
"node-sass": "^4.13.1",
|
||||
"eslint-plugin-flowtype": "^4.7.0",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-react": "^7.19.0",
|
||||
"eslint-plugin-react-hooks": "^3.0.0",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"node-sass": "^4.14.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||
"sass-loader": "^8.0.2",
|
||||
"style-loader": "^1.1.3",
|
||||
"terser-webpack-plugin": "^2.3.5",
|
||||
"style-loader": "^1.2.0",
|
||||
"terser-webpack-plugin": "^2.3.6",
|
||||
"typescript": "^3.8.3",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-dev-server": "^3.10.3"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,12 +15,11 @@ export function LocationIcon(props) {
|
|||
}
|
||||
|
||||
export function Rarity(props) {
|
||||
let { set, rarity } = props;
|
||||
return (
|
||||
<span>
|
||||
<img className={props.size || "icon16"} style={{ verticalAlign: 'middle' }} src={("/src/img/icons/set/" + props.set + "/" + props.rarity + ".png").toLowerCase()} />
|
||||
{!props.notext &&
|
||||
<React.Fragment>{API.sets[props.set]} | {props.rarity}</React.Fragment>
|
||||
}
|
||||
{set !== 'PE1' && <img className={props.size || "icon16"} style={{ verticalAlign: 'middle' }} src={("/src/img/icons/set/" + set + "/" + rarity + ".png").toLowerCase()} />}
|
||||
{!props.notext && <React.Fragment>{API.sets[props.set]} | {props.rarity}</React.Fragment>}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'whatwg-fetch';
|
||||
import loki from 'lokijs';
|
||||
import {observable, observe, action} from "mobx";
|
||||
import { observable, observe, action } from "mobx";
|
||||
import Cookies from 'universal-cookie';
|
||||
const cookies = new Cookies();
|
||||
|
||||
|
|
@ -42,11 +42,11 @@ class CollectionDB {
|
|||
if ((new Date(data[0].updated)) > (new Date(cookie))) {
|
||||
this[type].clear();
|
||||
this[type].insert(data);
|
||||
cookies.set(`${this.format}_${type}`, data[0].updated, {path: '/'});
|
||||
cookies.set(`${this.format}_${type}`, data[0].updated, { path: '/' });
|
||||
}
|
||||
}
|
||||
else {
|
||||
cookies.set(`${this.format}_${type}`, data[0].updated, {path: '/'});
|
||||
cookies.set(`${this.format}_${type}`, data[0].updated, { path: '/' });
|
||||
}
|
||||
});
|
||||
return resolve();
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@
|
|||
/* desktop */
|
||||
|
||||
.disciplines input {
|
||||
width: 30px;
|
||||
width: 22px;
|
||||
height: 14px;
|
||||
text-align: center;
|
||||
margin-top: 2px;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import React from 'react';
|
||||
import {observable} from "mobx";
|
||||
import {observer, inject} from 'mobx-react';
|
||||
import { observable } from "mobx";
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import Collapsible from 'react-collapsible';
|
||||
import API from '../../SpreadsheetData';
|
||||
import {Loading} from '../../Snippets';
|
||||
import { Loading } from '../../Snippets';
|
||||
import search_api from './search';
|
||||
|
||||
@inject((stores, props, context) => props) @observer
|
||||
|
|
@ -22,7 +22,7 @@ export default class SearchCollection extends React.Component {
|
|||
this.reset = this.reset.bind(this);
|
||||
this.handleTriggerClick = this.handleTriggerClick.bind(this);
|
||||
|
||||
this.props.handleContent([{'text': 'Loading...'}]);
|
||||
this.props.handleContent([{ 'text': 'Loading...' }]);
|
||||
|
||||
this.cleanInput();
|
||||
this.parseQuery();
|
||||
|
|
@ -59,15 +59,15 @@ export default class SearchCollection extends React.Component {
|
|||
subtypes: "",
|
||||
flavor: true,
|
||||
sets: {},
|
||||
types: {attack: false, battlegear: false, creature: false, location: false, mugic: false},
|
||||
rarity: {common: false, uncommon: false, rare: false, 'super rare': false, 'ultra rare': false, promo: false},
|
||||
tribes: {danian: false, 'm\'arrillian': false, mipedian: false, overworld: false, underworld: false, generic: false},
|
||||
elements: {fire: false, air: false, earth: false, water: false, none: false, and: false},
|
||||
disciplines: {courage: '', power: '', wisdom: '', speed: ''},
|
||||
energy: {min: '', max: ''},
|
||||
mcbp: {min: '', max: ''},
|
||||
mull: {unique: false, loyal: false, legendary: false, mixed: false},
|
||||
gender: {ambiguous: false, female: false, male: false}
|
||||
types: { attack: false, battlegear: false, creature: false, location: false, mugic: false },
|
||||
rarity: { common: false, uncommon: false, rare: false, 'super rare': false, 'ultra rare': false, promo: false },
|
||||
tribes: { danian: false, 'm\'arrillian': false, mipedian: false, overworld: false, underworld: false, generic: false },
|
||||
elements: { fire: false, air: false, earth: false, water: false, none: false, and: false },
|
||||
disciplines: { courage: '', power: '', wisdom: '', speed: '', max: false },
|
||||
energy: { min: '', max: '' },
|
||||
mcbp: { min: '', max: '' },
|
||||
mull: { unique: false, loyal: false, legendary: false, mixed: false },
|
||||
gender: { ambiguous: false, female: false, male: false }
|
||||
};
|
||||
for (const key in API.sets) input.sets[key.toLowerCase()] = false;
|
||||
|
||||
|
|
@ -100,6 +100,7 @@ export default class SearchCollection extends React.Component {
|
|||
if (query.hasOwnProperty('power')) this.input.disciplines.power = query.power;
|
||||
if (query.hasOwnProperty('wisdom')) this.input.disciplines.wisdom = query.wisdom;
|
||||
if (query.hasOwnProperty('speed')) this.input.disciplines.speed = query.speed;
|
||||
if (query.hasOwnProperty('disc_max')) this.input.disciplines.max = !!query.disc_max;
|
||||
if (query.hasOwnProperty('energy')) {
|
||||
let q = query.energy.split(',');
|
||||
if (q[0] >= 0) this.input.energy.min = q[0];
|
||||
|
|
@ -134,6 +135,7 @@ export default class SearchCollection extends React.Component {
|
|||
if (this.input.disciplines.power > 0) queryString += "power=" + this.input.disciplines.power + "&";
|
||||
if (this.input.disciplines.wisdom > 0) queryString += "wisdom=" + this.input.disciplines.wisdom + "&";
|
||||
if (this.input.disciplines.speed > 0) queryString += "speed=" + this.input.disciplines.speed + "&";
|
||||
if (this.input.disciplines.max) queryString += "disc_max=true&";
|
||||
if (this.input.energy.min != "" || this.input.energy.max != "") {
|
||||
queryString += "energy=";
|
||||
if (this.input.energy.min != "" && this.input.energy.min >= 0) queryString += this.input.energy.min;
|
||||
|
|
@ -180,12 +182,12 @@ export default class SearchCollection extends React.Component {
|
|||
let results = search_api(this.input);
|
||||
|
||||
if (results.length > 0) this.props.handleContent(results);
|
||||
else this.props.handleContent([{'text': 'No Results Found'}]);
|
||||
else this.props.handleContent([{ 'text': 'No Results Found' }]);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.loaded == false) {
|
||||
API.LoadDB([{'cards': 'attacks'}, {'cards': 'battlegear'}, {'cards': 'creatures'}, {'cards': 'locations'}, {'cards': 'mugic'}])
|
||||
API.LoadDB([{ 'cards': 'attacks' }, { 'cards': 'battlegear' }, { 'cards': 'creatures' }, { 'cards': 'locations' }, { 'cards': 'mugic' }])
|
||||
.then(() => {
|
||||
this.loaded = true;
|
||||
this.search();
|
||||
|
|
@ -196,7 +198,7 @@ export default class SearchCollection extends React.Component {
|
|||
const gen = (d, display, text) => {
|
||||
let tmp = [];
|
||||
Object.keys(this.input[d]).forEach((item, i) => {
|
||||
tmp.push(<label style={{display: display}} key={i}><input type="checkbox" name={item} checked={this.input[d][item]} onChange={e => this.handleChange(e, d)} />{text(item)}</label>
|
||||
tmp.push(<label style={{ display: display }} key={i}><input type="checkbox" name={item} checked={this.input[d][item]} onChange={e => this.handleChange(e, d)} />{text(item)}</label>
|
||||
);
|
||||
});
|
||||
return tmp;
|
||||
|
|
@ -228,8 +230,9 @@ export default class SearchCollection extends React.Component {
|
|||
|
||||
let disciplines = [];
|
||||
Object.keys(this.input.disciplines).forEach((item, i) => {
|
||||
if (i == 4) return;
|
||||
disciplines.push(<label key={i} className="disciplines"><input type="text" name={item} value={this.input.disciplines[item]} onChange={e => this.handleChange(e, "disciplines")} />
|
||||
<img className="icon20" style={{verticalAlign: 'bottom'}} src={"/src/img/icons/disciplines/"+item+".png"} />
|
||||
<img className="icon20" style={{ verticalAlign: 'middle', padding: "0px 2px" }} src={"/src/img/icons/disciplines/"+item+".png"} />
|
||||
</label>);
|
||||
});
|
||||
|
||||
|
|
@ -283,6 +286,14 @@ export default class SearchCollection extends React.Component {
|
|||
>
|
||||
<div className="disciplines">
|
||||
{disciplines}
|
||||
<label>Max
|
||||
<input
|
||||
type="checkbox" name="max"
|
||||
style={{ display: "inline", margin: "0px" }}
|
||||
checked={this.input.disciplines.max}
|
||||
onChange={e => this.handleChange(e, "disciplines")}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</CollapsibleWrapper>
|
||||
<CollapsibleWrapper
|
||||
|
|
@ -356,13 +367,13 @@ class CollapsibleWrapper extends React.Component {
|
|||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const {collapsed, type} = props;
|
||||
const { collapsed, type } = props;
|
||||
this.open = collapsed[type];
|
||||
this.trigger = props.title;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {type, children, onClick} = this.props;
|
||||
const { type, children, onClick } = this.props;
|
||||
|
||||
return (
|
||||
<Collapsible
|
||||
|
|
@ -376,4 +387,4 @@ class CollapsibleWrapper extends React.Component {
|
|||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,25 +44,25 @@ export default function search_api(input) {
|
|||
if (input.name.length > 0) {
|
||||
let inputname = cleanInputRegex(input.name);
|
||||
|
||||
attackResults = attackResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': inputname}},
|
||||
{'gsx$tags': {'$regex': inputname}},
|
||||
attackResults = attackResults.find({ '$or': [
|
||||
{ 'gsx$name': { '$regex': inputname }},
|
||||
{ 'gsx$tags': { '$regex': inputname }},
|
||||
]});
|
||||
battlegearResults = battlegearResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': inputname}},
|
||||
{'gsx$tags': {'$regex': inputname}},
|
||||
battlegearResults = battlegearResults.find({ '$or': [
|
||||
{ 'gsx$name': { '$regex': inputname }},
|
||||
{ 'gsx$tags': { '$regex': inputname }},
|
||||
]});
|
||||
creatureResults = creatureResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': inputname}},
|
||||
{'gsx$tags': {'$regex': inputname}},
|
||||
creatureResults = creatureResults.find({ '$or': [
|
||||
{ 'gsx$name': { '$regex': inputname }},
|
||||
{ 'gsx$tags': { '$regex': inputname }},
|
||||
]});
|
||||
locationResults = locationResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': inputname}},
|
||||
{'gsx$tags': {'$regex': inputname}}
|
||||
locationResults = locationResults.find({ '$or': [
|
||||
{ 'gsx$name': { '$regex': inputname }},
|
||||
{ 'gsx$tags': { '$regex': inputname }}
|
||||
]});
|
||||
mugicResults = mugicResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': inputname}},
|
||||
{'gsx$tags': {'$regex': inputname}},
|
||||
mugicResults = mugicResults.find({ '$or': [
|
||||
{ 'gsx$name': { '$regex': inputname }},
|
||||
{ 'gsx$tags': { '$regex': inputname }},
|
||||
]});
|
||||
}
|
||||
|
||||
|
|
@ -71,42 +71,42 @@ export default function search_api(input) {
|
|||
if (input.text.length > 0) {
|
||||
// split text by comma
|
||||
let textList = input.text.split(",").filter(Boolean).map((item) => {
|
||||
return ({'$regex': cleanInputRegex(item)});
|
||||
return ({ '$regex': cleanInputRegex(item) });
|
||||
});
|
||||
// clean text
|
||||
let inputtext = cleanInputRegex(input.text);
|
||||
|
||||
let parm = (() => {
|
||||
let list = [
|
||||
{'gsx$tags': {"$or": textList}},
|
||||
{'gsx$ability': {'$regex': inputtext}}
|
||||
{ 'gsx$tags': { "$or": textList }},
|
||||
{ 'gsx$ability': { '$regex': inputtext }}
|
||||
]
|
||||
if (input.flavor) {
|
||||
list.push({'gsx$flavortext': {"$or": textList}});
|
||||
list.push({'gsx$artist': {"$or": textList}});
|
||||
list.push({ 'gsx$flavortext': { "$or": textList }});
|
||||
list.push({ 'gsx$artist': { "$or": textList }});
|
||||
}
|
||||
return list;
|
||||
})();
|
||||
|
||||
attackResults = attackResults.find({'$or': parm});
|
||||
battlegearResults = battlegearResults.find({'$or': parm});
|
||||
creatureResults = creatureResults.find({'$or':
|
||||
(parm.concat([{'gsx$brainwashed': {'$regex': inputtext}}]))
|
||||
attackResults = attackResults.find({ '$or': parm });
|
||||
battlegearResults = battlegearResults.find({ '$or': parm });
|
||||
creatureResults = creatureResults.find({ '$or':
|
||||
(parm.concat([{ 'gsx$brainwashed': { '$regex': inputtext }}]))
|
||||
});
|
||||
locationResults = locationResults.find({'$or': parm});
|
||||
mugicResults = mugicResults.find({'$or': parm});
|
||||
locationResults = locationResults.find({ '$or': parm });
|
||||
mugicResults = mugicResults.find({ '$or': parm });
|
||||
}
|
||||
|
||||
// Subtypes / Initiative
|
||||
if (input.subtypes.length > 0) {
|
||||
let subtypesList = input.subtypes.split(",").filter(Boolean).map((item) => {
|
||||
return ({'$regex': cleanInputRegex(item)});
|
||||
return ({ '$regex': cleanInputRegex(item) });
|
||||
});
|
||||
|
||||
creatureResults = creatureResults.find({'gsx$types': {'$or': subtypesList}});
|
||||
locationResults = locationResults.find({'$or': [{'gsx$initiative': {'$or': subtypesList}}, {'gsx$types': {'$or': subtypesList}}]});
|
||||
creatureResults = creatureResults.find({ 'gsx$types': { '$or': subtypesList }});
|
||||
locationResults = locationResults.find({ '$or': [{ 'gsx$initiative': { '$or': subtypesList }}, { 'gsx$types': { '$or': subtypesList }}]});
|
||||
attackResults = attackResults.limit(0);
|
||||
battlegearResults = battlegearResults.find({'gsx$types': {'$or': subtypesList}});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$types': { '$or': subtypesList }});
|
||||
mugicResults = mugicResults.limit(0);
|
||||
}
|
||||
|
||||
|
|
@ -114,11 +114,11 @@ export default function search_api(input) {
|
|||
let tribesList = [];
|
||||
for (const tribe in input.tribes) {
|
||||
if (input.tribes[tribe])
|
||||
tribesList.push({'$regex': new RegExp(tribe, 'i')});
|
||||
tribesList.push({ '$regex': new RegExp(tribe, 'i') });
|
||||
}
|
||||
if (tribesList.length > 0) {
|
||||
creatureResults = creatureResults.find({'gsx$tribe': {'$or': tribesList}});
|
||||
mugicResults = mugicResults.find({'gsx$tribe': {'$or': tribesList}});
|
||||
creatureResults = creatureResults.find({ 'gsx$tribe': { '$or': tribesList }});
|
||||
mugicResults = mugicResults.find({ 'gsx$tribe': { '$or': tribesList }});
|
||||
attackResults = attackResults.limit(0);
|
||||
battlegearResults = battlegearResults.limit(0);
|
||||
locationResults = locationResults.limit(0);
|
||||
|
|
@ -154,8 +154,8 @@ export default function search_api(input) {
|
|||
});
|
||||
|
||||
if (el !== "") {
|
||||
creatureResults = creatureResults.find({'gsx$elements':
|
||||
{'$regex': new RegExp("^" + el.substring(0, el.length-2) + "\s*$", 'i')}
|
||||
creatureResults = creatureResults.find({ 'gsx$elements':
|
||||
{ '$regex': new RegExp("^" + el.substring(0, el.length-2) + "\s*$", 'i') }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -170,18 +170,18 @@ export default function search_api(input) {
|
|||
for (const element in input.elements) {
|
||||
if (element === "none" || element === "and") continue;
|
||||
if (input.elements[element]) {
|
||||
elementsList.push({'$regex': new RegExp(element, 'i')});
|
||||
elementsList2.push({['gsx$'+element]: {'$gte': 0}})
|
||||
elementsList.push({ '$regex': new RegExp(element, 'i') });
|
||||
elementsList2.push({ ['gsx$'+element]: { '$gte': 0 }})
|
||||
}
|
||||
}
|
||||
if (elementsList.length > 0) {
|
||||
if (input.elements.and) {
|
||||
creatureResults = creatureResults.find({'gsx$elements': {'$and': elementsList}});
|
||||
attackResults = attackResults.find({'$and': elementsList2});
|
||||
creatureResults = creatureResults.find({ 'gsx$elements': { '$and': elementsList }});
|
||||
attackResults = attackResults.find({ '$and': elementsList2 });
|
||||
}
|
||||
else {
|
||||
creatureResults = creatureResults.find({'gsx$elements': {'$or': elementsList}});
|
||||
attackResults = attackResults.find({'$or': elementsList2});
|
||||
creatureResults = creatureResults.find({ 'gsx$elements': { '$or': elementsList }});
|
||||
attackResults = attackResults.find({ '$or': elementsList2 });
|
||||
}
|
||||
|
||||
battlegearResults = battlegearResults.limit(0);
|
||||
|
|
@ -191,23 +191,24 @@ export default function search_api(input) {
|
|||
}
|
||||
|
||||
// Stats
|
||||
const max_disc = (input.disciplines.max ? input.disciplines.max : false) ? '$lte' : '$gte';
|
||||
if (input.disciplines.courage > 0)
|
||||
creatureResults = creatureResults.find({'gsx$courage': {'$gte': input.disciplines.courage}});
|
||||
creatureResults = creatureResults.find({ 'gsx$courage': { [max_disc]: input.disciplines.courage }});
|
||||
|
||||
if (input.disciplines.power > 0)
|
||||
creatureResults = creatureResults.find({'gsx$power': {'$gte': input.disciplines.power}});
|
||||
creatureResults = creatureResults.find({ 'gsx$power': { [max_disc]: input.disciplines.power }});
|
||||
|
||||
if (input.disciplines.wisdom > 0)
|
||||
creatureResults = creatureResults.find({'gsx$wisdom': {'$gte': input.disciplines.wisdom}});
|
||||
creatureResults = creatureResults.find({ 'gsx$wisdom': { [max_disc]: input.disciplines.wisdom }});
|
||||
|
||||
if (input.disciplines.speed > 0)
|
||||
creatureResults = creatureResults.find({'gsx$speed': {'$gte': input.disciplines.speed}});
|
||||
creatureResults = creatureResults.find({ 'gsx$speed': { [max_disc]: input.disciplines.speed }});
|
||||
|
||||
if (input.energy.min > 0)
|
||||
creatureResults = creatureResults.find({'gsx$energy': {'$gte': input.energy.min}});
|
||||
creatureResults = creatureResults.find({ 'gsx$energy': { '$gte': input.energy.min }});
|
||||
|
||||
if (input.energy.max > 0 && input.energy.max >= input.energy.min)
|
||||
creatureResults = creatureResults.find({'gsx$energy': {'$lte': input.energy.max}});
|
||||
creatureResults = creatureResults.find({ 'gsx$energy': { '$lte': input.energy.max }});
|
||||
|
||||
// (if any stats, filter out non-Creatures)
|
||||
if (input.energy.min > 0 || input.energy.max > 0 || input.disciplines.courage > 0 || input.disciplines.power > 0 || input.disciplines.wisdom > 0 || input.disciplines.speed > 0) {
|
||||
|
|
@ -219,14 +220,14 @@ export default function search_api(input) {
|
|||
|
||||
// Mugic Counters/Cost | Build Points
|
||||
if (input.mcbp.min !== "" && input.mcbp.min >= 0) {
|
||||
attackResults = attackResults.find({'gsx$bp': {'$gte': input.mcbp.min}});
|
||||
creatureResults = creatureResults.find({'gsx$mugicability': {'$gte': input.mcbp.min}});
|
||||
mugicResults = mugicResults.find({'gsx$cost': {'$gte': input.mcbp.min}});
|
||||
attackResults = attackResults.find({ 'gsx$bp': { '$gte': input.mcbp.min }});
|
||||
creatureResults = creatureResults.find({ 'gsx$mugicability': { '$gte': input.mcbp.min }});
|
||||
mugicResults = mugicResults.find({ 'gsx$cost': { '$gte': input.mcbp.min }});
|
||||
}
|
||||
if (input.mcbp.max !== "" && input.mcbp.max >= 0 && input.mcbp.max >= input.mcbp.min) {
|
||||
attackResults = attackResults.find({'gsx$bp': {'$lte': input.mcbp.max}});
|
||||
creatureResults = creatureResults.find({'gsx$mugicability': {'$lte': input.mcbp.max}});
|
||||
mugicResults = mugicResults.find({'gsx$cost': {'$lte': input.mcbp.max}});
|
||||
attackResults = attackResults.find({ 'gsx$bp': { '$lte': input.mcbp.max }});
|
||||
creatureResults = creatureResults.find({ 'gsx$mugicability': { '$lte': input.mcbp.max }});
|
||||
mugicResults = mugicResults.find({ 'gsx$cost': { '$lte': input.mcbp.max }});
|
||||
}
|
||||
|
||||
// filter out Battlegear and Locations if mcbp
|
||||
|
|
@ -237,36 +238,36 @@ export default function search_api(input) {
|
|||
|
||||
// Unique
|
||||
if (input.mull.unique) {
|
||||
attackResults = attackResults.find({'gsx$unique': {'$gt': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$unique': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$unique': {'$gt': 0}});
|
||||
locationResults = locationResults.find({'gsx$unique': {'$gt': 0}});
|
||||
mugicResults = mugicResults.find({'gsx$unique': {'$gt': 0}});
|
||||
attackResults = attackResults.find({ 'gsx$unique': { '$gt': 0 }});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$unique': { '$gt': 0 }});
|
||||
creatureResults = creatureResults.find({ 'gsx$unique': { '$gt': 0 }});
|
||||
locationResults = locationResults.find({ 'gsx$unique': { '$gt': 0 }});
|
||||
mugicResults = mugicResults.find({ 'gsx$unique': { '$gt': 0 }});
|
||||
}
|
||||
|
||||
// Loyal
|
||||
if (input.mull.loyal) {
|
||||
attackResults = attackResults.limit(0);
|
||||
battlegearResults = battlegearResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$loyal': { '$gt': 0 }});
|
||||
creatureResults = creatureResults.find({ 'gsx$loyal': { '$gt': 0 }});
|
||||
mugicResults = mugicResults.limit(0);
|
||||
locationResults = locationResults.limit(0);
|
||||
}
|
||||
|
||||
// Legendary
|
||||
if (input.mull.legendary) {
|
||||
attackResults = attackResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
locationResults = locationResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
mugicResults = mugicResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
attackResults = attackResults.find({ 'gsx$legendary': { '$gt': 0 }});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$legendary': { '$gt': 0 }});
|
||||
creatureResults = creatureResults.find({ 'gsx$legendary': { '$gt': 0 }});
|
||||
locationResults = locationResults.find({ 'gsx$legendary': { '$gt': 0 }});
|
||||
mugicResults = mugicResults.find({ 'gsx$legendary': { '$gt': 0 }});
|
||||
}
|
||||
|
||||
// Non Loyal
|
||||
if (input.mull.mixed) {
|
||||
attackResults = attackResults.limit(0);
|
||||
creatureResults = creatureResults.find({'gsx$loyal': {'$lte': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$loyal': {'$lte': 0}});
|
||||
creatureResults = creatureResults.find({ 'gsx$loyal': { '$lte': 0 }});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$loyal': { '$lte': 0 }});
|
||||
mugicResults = mugicResults.limit(0);
|
||||
locationResults = locationResults.limit(0);
|
||||
}
|
||||
|
|
@ -276,36 +277,36 @@ export default function search_api(input) {
|
|||
|
||||
for (let key in input.sets) {
|
||||
if (input.sets[key])
|
||||
setsList.push({'$eq': key.toUpperCase()});
|
||||
setsList.push({ '$eq': key.toUpperCase() });
|
||||
}
|
||||
if (setsList.length === 0) {
|
||||
// Only show prototype cards when explicitly selected
|
||||
let keys = Object.keys(input.sets);
|
||||
if (!input.sets.proto) keys.splice(keys.indexOf("proto"));
|
||||
for (let i in keys) {
|
||||
setsList.push({'$eq': keys[i].toUpperCase()});
|
||||
setsList.push({ '$eq': keys[i].toUpperCase() });
|
||||
}
|
||||
}
|
||||
if (setsList.length > 0) {
|
||||
attackResults = attackResults.find({'gsx$set': {'$or': setsList}});
|
||||
battlegearResults = battlegearResults.find({'gsx$set': {'$or': setsList}});
|
||||
creatureResults = creatureResults.find({'gsx$set': {'$or': setsList}});
|
||||
locationResults = locationResults.find({'gsx$set': {'$or': setsList}});
|
||||
mugicResults = mugicResults.find({'gsx$set': {'$or': setsList}});
|
||||
attackResults = attackResults.find({ 'gsx$set': { '$or': setsList }});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$set': { '$or': setsList }});
|
||||
creatureResults = creatureResults.find({ 'gsx$set': { '$or': setsList }});
|
||||
locationResults = locationResults.find({ 'gsx$set': { '$or': setsList }});
|
||||
mugicResults = mugicResults.find({ 'gsx$set': { '$or': setsList }});
|
||||
}
|
||||
|
||||
// Rarity
|
||||
let rarityList = [];
|
||||
for (const key in input.rarity) {
|
||||
if (input.rarity[key])
|
||||
rarityList.push({'$eq': key.split(" ").map(st => {return st.charAt(0).toUpperCase()+st.slice(1)}).join(" ")});
|
||||
rarityList.push({ '$eq': key.split(" ").map(st => {return st.charAt(0).toUpperCase()+st.slice(1)}).join(" ") });
|
||||
}
|
||||
if (rarityList.length > 0) {
|
||||
attackResults = attackResults.find({'gsx$rarity': {'$or': rarityList}});
|
||||
battlegearResults = battlegearResults.find({'gsx$rarity': {'$or': rarityList}});
|
||||
creatureResults = creatureResults.find({'gsx$rarity': {'$or': rarityList}});
|
||||
locationResults = locationResults.find({'gsx$rarity': {'$or': rarityList}});
|
||||
mugicResults = mugicResults.find({'gsx$rarity': {'$or': rarityList}});
|
||||
attackResults = attackResults.find({ 'gsx$rarity': { '$or': rarityList }});
|
||||
battlegearResults = battlegearResults.find({ 'gsx$rarity': { '$or': rarityList }});
|
||||
creatureResults = creatureResults.find({ 'gsx$rarity': { '$or': rarityList }});
|
||||
locationResults = locationResults.find({ 'gsx$rarity': { '$or': rarityList }});
|
||||
mugicResults = mugicResults.find({ 'gsx$rarity': { '$or': rarityList }});
|
||||
}
|
||||
|
||||
// Gender
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import React from 'react';
|
||||
import API from '../../SpreadsheetData';
|
||||
import {observer, inject} from 'mobx-react';
|
||||
import {Rarity, Unique, Name, Mugic, Ability, Tribe} from '../../Snippets';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { Rarity, Unique, Name, Mugic, Ability, Tribe } from '../../Snippets';
|
||||
import MugicPlay from '../../mugicplayer/playbutton.tsx';
|
||||
import {withRouter} from 'react-router';
|
||||
import { withRouter } from 'react-router';
|
||||
|
||||
@inject((stores, props, context) => props) @observer
|
||||
class Attack extends React.Component {
|
||||
|
||||
render() {
|
||||
let {card, history} = this.props;
|
||||
let { card, history } = this.props;
|
||||
|
||||
let mugicCounters = [];
|
||||
if (card.gsx$cost == 0) {
|
||||
|
|
@ -31,18 +31,17 @@ class Attack extends React.Component {
|
|||
|
||||
if (this.props.ext == false) return (
|
||||
<div className="card mugic">
|
||||
<img className="thumb" style={{float: 'left'}} src={API.base_image + (card.gsx$thumb||API.thumb_missing)} onClick={() => this.props.setImage(card.gsx$image)} />
|
||||
<img className="thumb" style={{ float: 'left' }} src={API.base_image + (card.gsx$thumb||API.thumb_missing)} onClick={() => this.props.setImage(card.gsx$image)} />
|
||||
<div className="left">
|
||||
<Name name={card.gsx$name} /><br />
|
||||
<Rarity set={card.gsx$set} rarity={card.gsx$rarity} /> <br />
|
||||
<Tribe size="icon16" tribe={card.gsx$tribe} /> Mugic - {card.gsx$tribe}<br />
|
||||
<span>{mugicCounters}</span>{location.pathname.includes("/beta/") &&
|
||||
<MugicPlay notes={card.gsx$notes}/>}<br />
|
||||
<span>{mugicCounters}</span><MugicPlay notes={card.gsx$notes}/><br />
|
||||
</div>
|
||||
<br />
|
||||
<div className="right" >
|
||||
<Ability ability={card.gsx$ability} tribe={card.gsx$tribe} />
|
||||
<Unique data={{unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary}} />
|
||||
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary }} />
|
||||
<span className="flavortext">{card.gsx$flavortext}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -53,7 +52,7 @@ class Attack extends React.Component {
|
|||
<div className="right" >
|
||||
<Name name={card.gsx$name} /><br />
|
||||
<Ability ability={card.gsx$ability} tribe={card.gsx$tribe} />
|
||||
<Unique data={{unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary}} />
|
||||
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary }} />
|
||||
{card.gsx$flavortext && <React.Fragment>
|
||||
<span className="flavortext">{card.gsx$flavortext}</span><br />
|
||||
</React.Fragment>}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,34 @@
|
|||
import {Transport, Synth, Part} from 'tone';
|
||||
import {Transport, Synth, Part, Time, SynthOptions} from 'tone';
|
||||
|
||||
// https://github.com/Tonejs/Tone.js/wiki/Time
|
||||
// https://github.com/Tonejs/Tone.js/wiki/Events
|
||||
interface note_value {
|
||||
time: number
|
||||
pitch: string,
|
||||
duration: number,
|
||||
velocity?: number
|
||||
}
|
||||
export class Note {
|
||||
pitch: string;
|
||||
octave: number;
|
||||
duration: number;
|
||||
time: number;
|
||||
duration: number;
|
||||
velocity: number;
|
||||
|
||||
constructor(duration: number, time: number, value: {pitch: string, octave: number}) {
|
||||
constructor(duration: number, time: number, value: {pitch: string, octave: number}, velocity?: number) {
|
||||
this.duration = duration;
|
||||
this.time = time;
|
||||
this.pitch = value.pitch;
|
||||
this.octave = value.octave;
|
||||
this.time = time;
|
||||
if (velocity) this.velocity = velocity;
|
||||
}
|
||||
|
||||
get note() {
|
||||
get value(): note_value {
|
||||
return {
|
||||
time: this.time + "/4n",
|
||||
time: Time(this.time).quantize("4n") / 4,
|
||||
pitch: this.pitch + this.octave.toString(),
|
||||
duration: this.duration + "/4n"
|
||||
duration: Time(this.duration).quantize("4n") / 4,
|
||||
velocity: this.velocity,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +37,6 @@ export class MugicPlayer {
|
|||
private static instance: MugicPlayer;
|
||||
private synth: Synth;
|
||||
private part: Part;
|
||||
private transport: Transport;
|
||||
|
||||
// Singleton
|
||||
static getInstance() {
|
||||
|
|
@ -37,9 +45,24 @@ export class MugicPlayer {
|
|||
}
|
||||
|
||||
constructor() {
|
||||
this.synth = new Synth().toDestination();
|
||||
this.part = new Part();
|
||||
Transport.bpm.value = 240;
|
||||
const options = {
|
||||
frequency: 440,
|
||||
oscillator: {
|
||||
// frequency: 440
|
||||
type: "triangle" as any
|
||||
},
|
||||
envelope: {
|
||||
attack: 0.40,
|
||||
decay: 0.10,
|
||||
release: 1,
|
||||
sustain: 0.3,
|
||||
attackCurve: "cosine" as any,
|
||||
releaseCurve: "exponential" as any,
|
||||
decayCurve: "exponential" as any
|
||||
}
|
||||
};
|
||||
this.synth = new Synth(options).toDestination();
|
||||
Transport.bpm.value = 140;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,17 +74,17 @@ export class MugicPlayer {
|
|||
// up down up up down up
|
||||
play(input: string) {
|
||||
Transport.stop();
|
||||
this.part.dispose();
|
||||
if (this.part) this.part.dispose();
|
||||
|
||||
try {
|
||||
const tune = parseTune(input);
|
||||
|
||||
console.log(tune.map(n => n.value.pitch));
|
||||
this.part = new Part(
|
||||
(time: number, note: any) => {
|
||||
// console.log(time, note);
|
||||
this.synth.triggerAttackRelease(note.pitch, note.duration, time);
|
||||
(time, val: note_value) => {
|
||||
console.log(val);
|
||||
this.synth.triggerAttackRelease(val.pitch, val.duration, time, val.velocity);
|
||||
},
|
||||
tune.map((n) => n.note)
|
||||
tune.map((n) => n.value)
|
||||
).start();
|
||||
|
||||
Transport.start();
|
||||
|
|
|
|||
|
|
@ -95,9 +95,9 @@ module.exports = {
|
|||
'@babel/plugin-transform-runtime',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
['@babel/plugin-proposal-decorators', {legacy: true}],
|
||||
['@babel/plugin-proposal-class-properties', {loose: true}],
|
||||
['@babel/plugin-transform-computed-properties', {loose: true}],
|
||||
['@babel/plugin-proposal-decorators', { legacy: true }],
|
||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
||||
['@babel/plugin-transform-computed-properties', { loose: true }],
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user