Merge branch 'develop' of ssh://git.mnml.gg:40022/~/mnml into develop
This commit is contained in:
commit
d873c80e92
@ -20,8 +20,6 @@
|
|||||||
* msg pane
|
* msg pane
|
||||||
* game invites
|
* game invites
|
||||||
|
|
||||||
* add speed to descriptions
|
|
||||||
|
|
||||||
## SOON
|
## SOON
|
||||||
*SERVER*
|
*SERVER*
|
||||||
* modules
|
* modules
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
@import 'colours.less';
|
||||||
|
|
||||||
aside {
|
aside {
|
||||||
grid-area: ctrl;
|
grid-area: ctrl;
|
||||||
display: grid;
|
display: grid;
|
||||||
@ -93,3 +95,16 @@ aside {
|
|||||||
.team-page-ctrl h2 {
|
.team-page-ctrl h2 {
|
||||||
padding: 0 0.75em 0 0.75em;
|
padding: 0 0.75em 0 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.abandon {
|
||||||
|
&:hover {
|
||||||
|
color: @red;
|
||||||
|
border-color: @red;
|
||||||
|
};
|
||||||
|
|
||||||
|
&:active, &.confirming {
|
||||||
|
background: @red;
|
||||||
|
color: black;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -91,7 +91,7 @@ class Slay extends Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
anime.set('#slay', {
|
anime.set('#slay', {
|
||||||
translateY: (window.screen.height) * 0.35 * this.props.direction.y,
|
translateY: -1 * (window.screen.height) * 0.35,
|
||||||
translateX: 0,
|
translateX: 0,
|
||||||
});
|
});
|
||||||
anime.set('#explosion feDisplacementMap', {
|
anime.set('#explosion feDisplacementMap', {
|
||||||
|
|||||||
@ -56,7 +56,7 @@ function Collection(args) {
|
|||||||
teamSelect[insert] = id;
|
teamSelect[insert] = id;
|
||||||
return setTeam(teamSelect);
|
return setTeam(teamSelect);
|
||||||
}
|
}
|
||||||
console.log(constructs.length);
|
|
||||||
const dispConstructs = constructs.length >= ((teamPage + 1) * 6)
|
const dispConstructs = constructs.length >= ((teamPage + 1) * 6)
|
||||||
? constructs.slice(teamPage * 6, (teamPage + 1) * 6)
|
? constructs.slice(teamPage * 6, (teamPage + 1) * 6)
|
||||||
: constructs.slice(teamPage * 6, constructs.length);
|
: constructs.slice(teamPage * 6, constructs.length);
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const range = require('lodash/range');
|
|||||||
const reactStringReplace = require('react-string-replace');
|
const reactStringReplace = require('react-string-replace');
|
||||||
|
|
||||||
const { INFO } = require('./../constants');
|
const { INFO } = require('./../constants');
|
||||||
const { convertItem } = require('../utils');
|
const { convertItem, removeTier, itemSpeed } = require('../utils');
|
||||||
const shapes = require('./shapes');
|
const shapes = require('./shapes');
|
||||||
|
|
||||||
function InfoComponent(args) {
|
function InfoComponent(args) {
|
||||||
@ -40,12 +40,23 @@ function InfoComponent(args) {
|
|||||||
if (isSkill) {
|
if (isSkill) {
|
||||||
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
||||||
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
||||||
|
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(info));
|
||||||
|
const itemSourceInfo = itemSource.length
|
||||||
|
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
|
||||||
|
: false;
|
||||||
|
const itemRegEx = /(Red|Blue|Green)/;
|
||||||
|
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
|
||||||
|
const calcSpeed = itemSource.length
|
||||||
|
? (24 + (itemSpeed(itemSource[0].components[0]) + itemSpeed(itemSource[0].components[1])) * itemSpeed(itemSource[0].components[2])) * 4
|
||||||
|
: (24 + itemSpeed(info)) * 4;
|
||||||
|
const speed = <div> Speed {shapes.SpeedStat()} multiplier {calcSpeed}% </div>;
|
||||||
return (
|
return (
|
||||||
<div class="info-skill">
|
<div class="info-skill">
|
||||||
<h2>{fullInfo.item}</h2>
|
<h2>{fullInfo.item}</h2>
|
||||||
<h3>SKILL</h3>
|
<h3>SKILL</h3>
|
||||||
|
{itemSourceDescription}
|
||||||
<div>{infoDescription}</div>
|
<div>{infoDescription}</div>
|
||||||
|
{speed}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -135,11 +146,18 @@ function InfoComponent(args) {
|
|||||||
});
|
});
|
||||||
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
||||||
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
||||||
|
const itemSource = itemInfo.combos.filter(c => c.item === info);
|
||||||
|
const itemSourceInfo = itemSource.length
|
||||||
|
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
|
||||||
|
: false;
|
||||||
|
const itemRegEx = /(Red|Blue|Green)/;
|
||||||
|
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="info-spec">
|
<div class="info-spec">
|
||||||
<h2>{info}</h2>
|
<h2>{info}</h2>
|
||||||
<h3>SPEC</h3>
|
<h3>SPEC</h3>
|
||||||
|
{itemSourceDescription}
|
||||||
<div>{infoDescription}</div>
|
<div>{infoDescription}</div>
|
||||||
<div class="thresholds">
|
<div class="thresholds">
|
||||||
{thresholds}
|
{thresholds}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
const { Component } = require('preact')
|
||||||
const { connect } = require('preact-redux');
|
const { connect } = require('preact-redux');
|
||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
@ -8,7 +9,16 @@ const addState = connect(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
function Scoreboard(args) {
|
|
||||||
|
class Scoreboard extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
abandonState: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
render(args, state) {
|
||||||
const {
|
const {
|
||||||
abandon,
|
abandon,
|
||||||
animating,
|
animating,
|
||||||
@ -18,6 +28,8 @@ function Scoreboard(args) {
|
|||||||
clear,
|
clear,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
|
const { abandonState } = state;
|
||||||
|
|
||||||
const scoreText = () => {
|
const scoreText = () => {
|
||||||
if (player.score === 'Zero') return '▫▫▫▫';
|
if (player.score === 'Zero') return '▫▫▫▫';
|
||||||
if (player.score === 'One') return '■▫▫▫';
|
if (player.score === 'One') return '■▫▫▫';
|
||||||
@ -28,6 +40,15 @@ function Scoreboard(args) {
|
|||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const divClick = e => {
|
||||||
|
e.stopPropagation();
|
||||||
|
return this.setState({ abandonState: false });
|
||||||
|
};
|
||||||
|
const abandonStateTrue = e => {
|
||||||
|
e.stopPropagation();
|
||||||
|
this.setState({ abandonState: true });
|
||||||
|
};
|
||||||
|
|
||||||
if (!isPlayer) {
|
if (!isPlayer) {
|
||||||
return (
|
return (
|
||||||
<div class={`player-box top ${player.ready ? 'ready' : ''}`}>
|
<div class={`player-box top ${player.ready ? 'ready' : ''}`}>
|
||||||
@ -39,17 +60,23 @@ function Scoreboard(args) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const abandonClasses = `abandon ${abandonState ? 'confirming' : ''}`;
|
||||||
|
const abandonAction = abandonState ? abandon : abandonStateTrue;
|
||||||
return (
|
return (
|
||||||
<div class={`player-box bottom ${player.ready ? 'ready' : ''}`}>
|
<div onClick={divClick} class={`player-box bottom ${player.ready ? 'ready' : ''}`}>
|
||||||
<div class="score">{scoreText()}</div>
|
<div class="score">{scoreText()}</div>
|
||||||
<div class="img">
|
<div class="img">
|
||||||
<div>{player.name}</div>
|
<div>{player.name}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
{(isPlayer && isGame) ? <button disabled={animating} onClick={clear}>Clear</button> : null}
|
{(isPlayer && isGame) ? <button disabled={animating} onClick={clear}>Clear</button> : null}
|
||||||
{(abandon) ? <button disabled={animating} onClick={abandon}>Abandon</button> : null}
|
</div>
|
||||||
|
<div>
|
||||||
|
{(abandon) ? <button class={abandonClasses} disabled={animating} onClick={abandonAction}>Abandon</button> : null}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = addState(Scoreboard);
|
module.exports = addState(Scoreboard);
|
||||||
|
|||||||
@ -169,7 +169,7 @@ function registerEvents(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setInstance(v) {
|
function setInstance(v) {
|
||||||
const { account, instance } = store.getState();
|
const { account, instance, ws } = store.getState();
|
||||||
if (v) {
|
if (v) {
|
||||||
const player = v.players.find(p => p.id === account.id);
|
const player = v.players.find(p => p.id === account.id);
|
||||||
store.dispatch(actions.setPlayer(player));
|
store.dispatch(actions.setPlayer(player));
|
||||||
@ -180,7 +180,11 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setActiveConstruct(first));
|
store.dispatch(actions.setActiveConstruct(first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (v.phase === 'Finished') setGame(null);
|
if (v.phase === 'Finished') {
|
||||||
|
setGame(null);
|
||||||
|
ws.sendAccountInstances();
|
||||||
|
}
|
||||||
|
|
||||||
return store.dispatch(actions.setInstance(v));
|
return store.dispatch(actions.setInstance(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,6 +187,20 @@ const removeTier = skill => {
|
|||||||
return skill;
|
return skill;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function itemSpeed(item) {
|
||||||
|
switch (item) {
|
||||||
|
case 'Attack': return 1;
|
||||||
|
case 'Stun': return 2;
|
||||||
|
case 'Block': return 3;
|
||||||
|
case 'Buff': return 4;
|
||||||
|
case 'Debuff': return 4;
|
||||||
|
case 'Red': return 3;
|
||||||
|
case 'Green': return 2;
|
||||||
|
case 'Blue': return 1;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function postData(url = '/', data = {}) {
|
function postData(url = '/', data = {}) {
|
||||||
// Default options are marked with *
|
// Default options are marked with *
|
||||||
return fetch(`/api${url}`, {
|
return fetch(`/api${url}`, {
|
||||||
@ -250,5 +264,6 @@ module.exports = {
|
|||||||
TARGET_COLOURS,
|
TARGET_COLOURS,
|
||||||
randomPoints,
|
randomPoints,
|
||||||
removeTier,
|
removeTier,
|
||||||
|
itemSpeed,
|
||||||
match,
|
match,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -83,6 +83,7 @@ pub enum RpcRequest {
|
|||||||
|
|
||||||
AccountState {},
|
AccountState {},
|
||||||
AccountShop {},
|
AccountShop {},
|
||||||
|
AccountInstances {},
|
||||||
AccountConstructs {},
|
AccountConstructs {},
|
||||||
AccountSetTeam { ids: Vec<Uuid> },
|
AccountSetTeam { ids: Vec<Uuid> },
|
||||||
|
|
||||||
@ -154,7 +155,8 @@ impl Connection {
|
|||||||
Ok(RpcMessage::AccountState(account.clone())),
|
Ok(RpcMessage::AccountState(account.clone())),
|
||||||
RpcRequest::AccountConstructs {} =>
|
RpcRequest::AccountConstructs {} =>
|
||||||
Ok(RpcMessage::AccountConstructs(account::constructs(&mut tx, &account)?)),
|
Ok(RpcMessage::AccountConstructs(account::constructs(&mut tx, &account)?)),
|
||||||
|
RpcRequest::AccountInstances {} =>
|
||||||
|
Ok(RpcMessage::AccountInstances(account::account_instances(&mut tx, account)?)),
|
||||||
RpcRequest::AccountSetTeam { ids } =>
|
RpcRequest::AccountSetTeam { ids } =>
|
||||||
Ok(RpcMessage::AccountTeam(account::set_team(&mut tx, &account, ids)?)),
|
Ok(RpcMessage::AccountTeam(account::set_team(&mut tx, &account, ids)?)),
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user