Merge branch 'release/1.6.3'

This commit is contained in:
ntr 2019-10-23 16:47:15 +11:00
commit c5657c2895
39 changed files with 3130 additions and 516 deletions

View File

@ -2,6 +2,19 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [1.6.3] - 2019-10-23
### Added
- MNNI: the MNML guide
- Delivers the message of the day
### Fixed
- Fixed issue where dots / hots would not trigger when reapplied at a higher speed
- Changed layout of home page. UI elements for rerolling construct avatars moved to a separate tab.
- Added highlighting to first round of a game against the bots to guide new users
- Fixed UI issues related to scrolling
- Improved the invite link
## [1.6.2] - 2019-10-20 ## [1.6.2] - 2019-10-20
### Fixed ### Fixed
- Combiner bug where it would preview items for different combinations - Combiner bug where it would preview items for different combinations

View File

@ -1 +1 @@
1.6.2 1.6.3

View File

@ -3,29 +3,20 @@
*PRODUCTION* *PRODUCTION*
* rename vbox to shop * vbox phase skill list navigator (overlay maybe?)
* give the shop and inventory distinct delineation * can't reset password without knowing password =\
* proper victory / lose page instead of just face off (you are the winner or something)
* mobile styles * mobile styles
* mobile info page * mobile info page
* fix info page for tablet layout * fix info page for tablet layout
* can't reset password without knowing password =\
* Invert recharge * Invert recharge
* serde serialize privatise
* chat
* Convert spec 'Plus' -> '+' when it appears as combo text in combiner and in info text
## SOON ## SOON
* equip from shop (buy and equip without putting in your inventory) for bases * equip from shop (buy and equip without putting in your inventory) for bases
* move item from one construct to another * move item from one construct to another
* bot game grind
* ACP * ACP
* essential * essential
* audio * audio
@ -38,7 +29,7 @@
* remove names so games/instances are copy * remove names so games/instances are copy
*$$$* *$$$*
* chatwheel * instead of red noise, red and black bar gradient
* eth adapter * eth adapter
* illusions * illusions
* vaporwave * vaporwave
@ -65,6 +56,7 @@
## LATER ## LATER
* constants * constants
* bot game grind
$$$ $$$
* Items * Items

View File

@ -1,6 +1,6 @@
{ {
"name": "mnml-client", "name": "mnml-client",
"version": "1.6.2", "version": "1.6.3",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.0 KiB

2557
client/assets/mnni.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -131,6 +131,15 @@ svg {
} }
} }
@keyframes co-text {
from {
color: @black;
}
to {
color: @gray-exists;
}
}
button { button {
&.blue { &.blue {
border-color: @blue; border-color: @blue;

View File

@ -50,31 +50,6 @@ aside {
} }
} }
// button.ready:enabled {
// &:hover {
// color: forestgreen;
// border-color: forestgreen;
// }
// &:active, &:focus, &.enabled {
// background: forestgreen;
// color: black;
// border-color: forestgreen;
// }
// }
button.ready:enabled {
color: forestgreen;
border-color: forestgreen;
&:hover {
background: forestgreen;
color: black;
border-color: forestgreen;
}
}
.timer-container { .timer-container {
grid-area: timer; grid-area: timer;
@ -144,12 +119,6 @@ aside {
} }
} }
.play-ctrl {
.controls {
grid-template-rows: 1fr 1fr 1fr 3fr 1fr;
}
}
.abandon:not([disabled]) { .abandon:not([disabled]) {
&:hover { &:hover {
color: @red; color: @red;

View File

@ -235,6 +235,9 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
overflow: hidden;
max-height: 100%;
max-width: 100%;
} }
.combat-anim svg { .combat-anim svg {
@ -339,6 +342,9 @@
.skill-animation { .skill-animation {
opacity: 0; opacity: 0;
stroke-width: 5px; stroke-width: 5px;
overflow: hidden;
max-height: 100%;
max-width: 100%;
// height: 5em; // height: 5em;
} }

View File

@ -97,8 +97,7 @@
grid-template-columns: 1fr min-content 1fr; grid-template-columns: 1fr min-content 1fr;
grid-template-areas: grid-template-areas:
"vbox varrow inventory" "vbox varrow inventory"
"vbox . carrow" "vbox varrow combiner";
"vbox . combiner";
} }
.vbox-inventory { .vbox-inventory {
@ -112,15 +111,6 @@
justify-content: flex-end; justify-content: flex-end;
} }
.vbox-combiner-arrow {
color: @gray-hint;
grid-area: carrow;
display: block;
text-align: center;
font-size: 2em;
vertical-align: center;
}
.vbox-arrow, .vbox-arrow-mobile { .vbox-arrow, .vbox-arrow-mobile {
display: flex; display: flex;
justify-content:center; justify-content:center;
@ -413,9 +403,10 @@
text-align: center; text-align: center;
overflow: hidden; overflow: hidden;
display: grid; display: grid;
grid-template-rows: 1fr 1.5fr; grid-template-rows: 1fr 0.5fr 1.5fr;
grid-template-areas: grid-template-areas:
"opponent" "opponent"
"text"
"player"; "player";
h1 { h1 {
@ -428,14 +419,9 @@
margin-top: 1em; margin-top: 1em;
} }
.opponent-name { .winner {
margin-bottom: 1em; color: @yellow;
grid-area: oppname; font-weight: bold;
}
.player-name {
margin-top: 1em;
grid-area: playername;
} }
.team { .team {
@ -445,6 +431,39 @@
} }
} }
.faceoff-text {
grid-area: text;
font-size: 200%;
text-transform: uppercase;
letter-spacing: 1em;
font-weight: bold;
color: @black;
animation: faceoff 4s ease-in-out 0s 2 alternate;
&.winner {
animation: win 2s ease-in-out 0s 1;
}
}
@keyframes faceoff {
from {
color: @black;
}
to {
color: @white;
}
}
@keyframes win {
from {
color: @black;
}
to {
color: @yellow;
}
}
/* Mobile Nav*/ /* Mobile Nav*/
.instance-nav { display: none; } .instance-nav { display: none; }

View File

@ -35,6 +35,7 @@
.construct { .construct {
flex: 1 1 33%; flex: 1 1 33%;
overflow: hidden;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
@ -108,13 +109,40 @@ section {
letter-spacing: 0.25em; letter-spacing: 0.25em;
text-transform: uppercase; text-transform: uppercase;
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); // grid-template-columns: repeat(4, 1fr);
grid-template-columns: 1fr 1fr;
grid-gap: 1em; grid-gap: 1em;
flex-flow: row wrap; flex-flow: row wrap;
align-items: flex-end; align-items: flex-end;
button { button {
border-radius: 0.25em; border-radius: 0.25em;
// height: 3em;
} }
&.play {
grid-template-columns: repeat(2, 1fr);
align-items: flex-start;
&.rejoin {
grid-template-columns: 1fr;
}
button.ready:enabled {
color: forestgreen;
border-color: forestgreen;
&:hover {
background: forestgreen;
color: black;
border-color: forestgreen;
}
}
}
}
.panes {
display: grid;
grid-template-columns: repeat(2, 1fr);
} }
figure { figure {
@ -188,9 +216,14 @@ section {
.list { .list {
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
&.play {
grid-template-columns: 1fr;
} }
} }
}
.menu .team { .menu .team {
grid-template-columns: 1fr; grid-template-columns: 1fr;

View File

@ -2,6 +2,7 @@
.player-box { .player-box {
display: grid; display: grid;
overflow: hidden;
grid-template-areas: grid-template-areas:
"msg" "msg"
"img" "img"
@ -45,6 +46,11 @@
grid-area: msg; grid-area: msg;
color: @white; color: @white;
} }
&.winner {
color: @yellow;
font-weight: bold;
}
} }
.chat { .chat {

View File

@ -26,7 +26,7 @@ html body {
/* stops inspector going skitz*/ /* stops inspector going skitz*/
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; // overflow-y: hidden;
} }
// @media (min-width: 1921px) { // @media (min-width: 1921px) {
@ -281,7 +281,7 @@ ul {
} }
li { li {
margin-bottom: 0.5em; margin-bottom: 0;
} }
.logo { .logo {
@ -299,6 +299,10 @@ li {
background-position: center; background-position: center;
} }
.mnni {
background-image: url("./../mnni.svg");
}
.avatar { .avatar {
grid-area: avatar; grid-area: avatar;
object-fit: contain; object-fit: contain;

View File

@ -1,6 +1,6 @@
{ {
"name": "mnml-client", "name": "mnml-client",
"version": "1.6.2", "version": "1.6.3",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -15,9 +15,9 @@
"license": "UNLICENSED", "license": "UNLICENSED",
"dependencies": { "dependencies": {
"anime": "^0.1.2", "anime": "^0.1.2",
"animejs": "^3.0.1", "animejs": "^3.1.0",
"async": "^2.6.2", "async": "^2.6.3",
"borc": "^2.0.3", "borc": "^2.1.1",
"docco": "^0.7.0", "docco": "^0.7.0",
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",
"izitoast": "^1.4.0", "izitoast": "^1.4.0",
@ -26,15 +26,15 @@
"lodash": "^4.17.15", "lodash": "^4.17.15",
"logrocket": "^1.0.3", "logrocket": "^1.0.3",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
"parcel": "^1.12.3", "parcel": "^1.12.4",
"preact": "^8.4.2", "preact": "^8.5.2",
"preact-compat": "^3.19.0", "preact-compat": "^3.19.0",
"preact-context": "^1.1.3", "preact-context": "^1.1.4",
"preact-redux": "^2.1.0", "preact-redux": "^2.1.0",
"query-string": "^6.8.3", "query-string": "^6.8.3",
"react-string-replace": "^0.4.4", "react-string-replace": "^0.4.4",
"react-stripe-elements": "^3.0.0", "react-stripe-elements": "^3.0.1",
"redux": "^4.0.0" "redux": "^4.0.4"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
@ -42,11 +42,11 @@
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.1.0", "eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.14.0", "eslint-plugin-import": "^2.18.2",
"eslint-plugin-react": "^7.11.1", "eslint-plugin-react": "^7.16.0",
"jest": "^18.0.0", "jest": "^25.0.0",
"less": "^3.9.0" "less": "^3.10.3"
}, },
"alias": { "alias": {
"react": "preact-compat", "react": "preact-compat",

View File

@ -187,6 +187,7 @@ class AccountStatus extends Component {
class="login-input" class="login-input"
type="password" type="password"
name="new" name="new"
autocomplete="new-password"
value={passwordState.password} value={passwordState.password}
onInput={linkState(this, 'passwordState.password')} onInput={linkState(this, 'passwordState.password')}
placeholder="new password" placeholder="new password"
@ -195,6 +196,7 @@ class AccountStatus extends Component {
class="login-input" class="login-input"
type="password" type="password"
name="confirm" name="confirm"
autocomplete="new-password"
value={passwordState.confirm} value={passwordState.confirm}
onInput={linkState(this, 'passwordState.confirm')} onInput={linkState(this, 'passwordState.confirm')}
placeholder="confirm" placeholder="confirm"

View File

@ -38,7 +38,7 @@ function Controls(args) {
if (game) return <GameCtrl />; if (game) return <GameCtrl />;
if (instance) return <InstanceCtrl />; if (instance) return <InstanceCtrl />;
if (nav === 'play' || nav === 'shop' || !nav) return <PlayCtrl /> if (nav === 'play' || nav === 'shop' || nav === 'reshape' || !nav) return <PlayCtrl />
if (nav === 'team' || nav === 'account') return <TeamCtrl /> if (nav === 'team' || nav === 'account') return <TeamCtrl />
return false; return false;

View File

@ -58,7 +58,8 @@ function Faceoff(props) {
const constructs = team.constructs.map((c, i) => const constructs = team.constructs.map((c, i) =>
<FaceoffConstruct key={c.id} construct={c}/>); <FaceoffConstruct key={c.id} construct={c}/>);
const classes = `team player ${team.ready ? 'ready' : ''}` const winner = instance.winner === team.id;
const classes = `team player ${winner ? 'winner' : team.ready ? 'ready' : ''}`
return ( return (
<div class={classes}> <div class={classes}>
{constructs} {constructs}
@ -66,11 +67,13 @@ function Faceoff(props) {
); );
} }
function OpponentTeam(team) { function OpponentTeam(team) {
const constructs = team.constructs.map((c, i) => const constructs = team.constructs.map((c, i) =>
<FaceoffConstruct key={c.id} construct={c}/>); <FaceoffConstruct key={c.id} construct={c}/>);
const classes = `team opponent ${team.ready ? 'ready' : ''}` const winner = instance.winner === team.id;
const classes = `team opponent ${winner ? 'winner' : team.ready ? 'ready' : ''}`
return ( return (
<div class={classes}> <div class={classes}>
@ -78,10 +81,30 @@ function Faceoff(props) {
</div> </div>
); );
} }
function faceoffText() {
if (!instance.winner) {
return (
<div class="faceoff-text">
<div class="opponent-text"> {otherTeam.name} </div>
<div class="vs"> vs </div>
<div class="player-text"> {playerTeam.name} </div>
</div>
);
}
const winner = instance.winner === playerTeam.id ? playerTeam : otherTeam;
return (
<div class="faceoff-text winner">
<div> {winner.name} </div>
<div> wins </div>
</div>
)
}
return ( return (
<main class="faceoff"> <main class="faceoff">
{OpponentTeam(otherTeam)} {OpponentTeam(otherTeam)}
{faceoffText()}
{PlayerTeam(playerTeam)} {PlayerTeam(playerTeam)}
</main> </main>
); );

View File

@ -40,7 +40,7 @@ const addState = connect(
dispatch(actions.setItemEquip(null)); dispatch(actions.setItemEquip(null));
dispatch(actions.setItemUnequip([])); dispatch(actions.setItemUnequip([]));
dispatch(actions.setVboxHighlight([])); dispatch(actions.setVboxHighlight([]));
dispatch(actions.setMtxActive(null));
return dispatch(actions.setNav(place)); return dispatch(actions.setNav(place));
} }
@ -88,6 +88,11 @@ function Header(args) {
class={`login-btn ${nav === 'shop' ? 'highlight' : ''}`}> class={`login-btn ${nav === 'shop' ? 'highlight' : ''}`}>
Shop Shop
</button> </button>
<button
onClick={() => navTo('reshape')}
class={`login-btn ${nav === 'reshape' ? 'highlight' : ''}`}>
Reshape
</button>
<button <button
onClick={accountClick} onClick={accountClick}
class={`login-btn ${nav === 'account' ? 'highlight' : ''}`}> class={`login-btn ${nav === 'account' ? 'highlight' : ''}`}>

View File

@ -152,10 +152,11 @@ function InfoComponent(args) {
: false; : false;
const itemRegEx = /(Red|Blue|Green)/; const itemRegEx = /(Red|Blue|Green)/;
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]()); const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
const infoText = info.replace('Plus', '+');
return ( return (
<div class="info-spec"> <div class="info-spec">
<h2>{info} - {fullInfo.cost}b</h2> <h2>{infoText} - {fullInfo.cost}b</h2>
<h3>SPEC</h3> <h3>SPEC</h3>
{itemSourceDescription} {itemSourceDescription}
<div>{infoDescription}</div> <div>{infoDescription}</div>

View File

@ -95,7 +95,6 @@ class Instance extends Component {
bindSwipes() { bindSwipes() {
const instance = document.getElementById('instance'); const instance = document.getElementById('instance');
if (!instance) { if (!instance) {
console.log('no instance, binding in 50');
return setTimeout(this.bindSwipes, 50); return setTimeout(this.bindSwipes, 50);
} }
if (this.h) this.h.destroy(); if (this.h) this.h.destroy();
@ -116,7 +115,6 @@ class Instance extends Component {
setNavInstance((navInstance + 1) % 4); setNavInstance((navInstance + 1) % 4);
}); });
console.log('hammer gestures bound');
return true; return true;
} }
} }

View File

@ -43,11 +43,11 @@ function Controls(args) {
const zero = Date.parse(instance.phase_start); const zero = Date.parse(instance.phase_start);
const now = Date.now(); const now = Date.now();
const end = Date.parse(instance.phase_end); const end = Date.parse(instance.phase_end);
const timerPct = instance.phase_end const timerPct = instance.phase !== 'Finished' && instance.phase_end
? ((now - zero) / (end - zero) * 100) ? ((now - zero) / (end - zero) * 100)
: 100; : 100;
const displayColour = !instance.phase_end const displayColour = !instance.phase_end || instance.phase === 'Finished'
? '#222' ? '#222'
: player.ready : player.ready
? 'forestgreen' ? 'forestgreen'

View File

@ -6,6 +6,7 @@ const actions = require('./../actions');
const AccountTop = require('./account.top'); const AccountTop = require('./account.top');
const Play = require('./play'); const Play = require('./play');
const Shop = require('./shop'); const Shop = require('./shop');
const Reshape = require('./reshape');
const addState = connect( const addState = connect(
function receiveState(state) { function receiveState(state) {
@ -27,6 +28,7 @@ function Top(args) {
if (nav === 'account') return <AccountTop />; if (nav === 'account') return <AccountTop />;
if (nav === 'play') return <Play /> if (nav === 'play') return <Play />
if (nav === 'shop') return <Shop /> if (nav === 'shop') return <Shop />
if (nav === 'reshape') return <Reshape />
return false; return false;
} }

View File

@ -0,0 +1,63 @@
const { Component } = require('preact');
const preact = require('preact');
// const { connect } = require('preact-redux');
const idleAnimation = require('./anims/idle');
const wiggle = require('./anims/wiggle');
class MnniAvatatr extends Component {
constructor() {
super();
// The animation ids are a check to ensure that animations are not repeated
// When a new account animation is communicated with state it will have a corresponding Id
// which is a count of how many resoluttions have passed
this.animations = [];
this.resetAnimations = this.resetAnimations.bind(this);
}
render() {
const { account, mtxActive } = this.props;
return (
<div
class="img avatar mnni"
id="mnni"
onMouseDown={this.onClick.bind(this)}>
</div>
);
}
onClick() {
if (this.props.mtxActive) {
return this.props.sendMtxAccountApply();
}
return this.animations.push(wiggle('mnni', this.idle));
}
componentDidMount() {
this.idle = idleAnimation('mnni');
return this.animations.push(this.idle);
}
resetAnimations() {
for (let i = this.animations.length - 1; i >= 0; i--) {
this.animations[i].reset();
}
}
componentWillUnmount() {
this.resetAnimations();
}
}
function Mnni(args) {
return (
<div class='player-box top'>
<MnniAvatatr />
<div class="msg">hi!</div>
<div class="name">MNNI</div>
<div class="score">&nbsp;</div>
</div>
);
}
module.exports = Mnni;

View File

@ -1,156 +1,26 @@
const preact = require('preact'); const preact = require('preact');
const { connect } = require('preact-redux'); // const { connect } = require('preact-redux');
const { errorToast, infoToast } = require('../utils');
const AccountBox = require('./account.box'); const AccountBox = require('./account.box');
const Mnni = require('./mnni');
const addState = connect(
function receiveState(state) {
const {
ws,
instances,
invite,
} = state;
function sendInstanceState(id) {
ws.sendInstanceState(id);
}
function sendInstancePractice() {
ws.sendInstancePractice();
}
function sendInstanceQueue() {
ws.sendInstanceQueue();
}
function sendInstanceInvite() {
ws.sendInstanceInvite();
}
return {
instances,
invite,
sendInstanceState,
sendInstanceQueue,
sendInstancePractice,
sendInstanceInvite,
};
}
);
function JoinButtons(args) { function JoinButtons(args) {
const {
instances,
invite,
sendInstanceState,
sendInstanceQueue,
sendInstancePractice,
sendInstanceInvite,
} = args;
const discordBtn = (
<button
class='discord-btn'
onClick={() => window.open('https://discord.gg/YJJgurM') }>
&nbsp;
</button>
);
if (instances.length) {
return ( return (
<aside class='play-ctrl'> <aside class='play-ctrl'>
<div class="timer-container"></div> <div class="timer-container"></div>
<div class="controls"> <div class="controls">
{discordBtn} <div class="instance-ctrl-btns">
<div class="flex"> <button disabled={true}>-</button>
<div>&nbsp;</div>
</div> </div>
<Mnni />
<AccountBox /> <AccountBox />
<div class="instance-ctrl-btns"> <div class="instance-ctrl-btns">
<button disabled={true} >Chat</button> <button disabled={true} >Chat</button>
<button <button disabled={true}>-</button>
class='pvp ready full'
onClick={() => sendInstanceState(instances[0].id)}
type="submit">
Rejoin
</button>
</div>
</div>
</aside>
);
}
const inviteBtn = () => {
if (!invite) {
return (
<button
class='pvp ready'
onClick={() => sendInstanceInvite()}
type="submit">
Invite
</button>
);
}
function copyClick(e) {
const link = `${document.location.origin}#join=${invite}`;
const textArea = document.createElement('textarea', { id: '#clipboard' });
textArea.value = link;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
infoToast('Invite link copied to clipboard.');
} catch (err) {
console.error('link copy error', err);
errorToast('Invite link copy error.');
}
document.body.removeChild(textArea);
return true;
}
return (
<button
class='pvp ready enabled'
onClick={copyClick}
type="submit">
Copy Link
</button>
);
};
return (
<aside class='play-ctrl'>
<div class="timer-container"></div>
<div class="controls">
<button
class='practice ready'
onClick={() => sendInstancePractice()}
type="submit">
Learn
</button>
{inviteBtn()}
{discordBtn}
<AccountBox />
<div class="instance-ctrl-btns">
<button disabled={true} >Chat</button>
<button
class='pvp ready'
onClick={() => sendInstanceQueue()}
type="submit">
PVP
</button>
</div> </div>
</div> </div>
</aside> </aside>
); );
} }
module.exports = addState(JoinButtons); module.exports = JoinButtons;

View File

@ -1,12 +1,8 @@
// const { connect } = require('preact-redux'); // const { connect } = require('preact-redux');
const preact = require('preact'); const preact = require('preact');
const { connect } = require('preact-redux'); const { connect } = require('preact-redux');
const { Elements } = require('react-stripe-elements');
const Header = require('./header');
const Team = require('./team');
const StripeBtns = require('./stripe.buttons');
const { errorToast, infoToast } = require('../utils');
const actions = require('./../actions'); const actions = require('./../actions');
const VERSION = process.env.npm_package_version; const VERSION = process.env.npm_package_version;
@ -16,17 +12,35 @@ const addState = connect(
const { const {
ws, ws,
account, account,
shop, instances,
invite,
} = state; } = state;
function mtxBuy(mtx) { function sendInstanceState(id) {
return ws.sendMtxBuy(mtx.variant); ws.sendInstanceState(id);
}
function sendInstancePractice() {
ws.sendInstancePractice();
}
function sendInstanceQueue() {
ws.sendInstanceQueue();
}
function sendInstanceInvite() {
ws.sendInstanceInvite();
} }
return { return {
account, account,
shop, instances,
mtxBuy, invite,
sendInstanceState,
sendInstanceQueue,
sendInstancePractice,
sendInstanceInvite,
}; };
}, },
@ -51,32 +65,66 @@ const addState = connect(
function Play(args) { function Play(args) {
const { const {
account, account,
shop, instances,
mtxBuy, invite,
sendInstanceState,
sendInstanceQueue,
sendInstancePractice,
sendInstanceInvite,
setMtxActive,
setNav, setNav,
} = args; } = args;
if (!shop) return false; const inviteBtn = () => {
if (!invite) {
const useMtx = (item, i) => {
const price = item === 'Rename' ? 5 : 1;
return ( return (
<figure key={i} onClick={() => setMtxActive(item)} > <figure>
<figcaption>{item}</figcaption> <button
<button disabled={account.balance === 0}>¤{price}</button> class='ready'
onClick={() => sendInstanceInvite()}
type="submit">
Invite
</button>
<figcaption>Invite a Friend</figcaption>
</figure>
);
}
function copyClick(e) {
const link = `${document.location.origin}#join=${invite}`;
const textArea = document.createElement('textarea', { id: '#clipboard' });
textArea.value = link;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
infoToast('Invite link copied to clipboard.');
} catch (err) {
console.error('link copy error', err);
errorToast('Invite link copy error.');
}
document.body.removeChild(textArea);
return true;
}
return (
<figure>
<button
class='ready'
onClick={copyClick}
type="submit">
Copy &#x1F517;
</button>
<figcaption>Invite Generated</figcaption>
</figure> </figure>
); );
}; };
const availableMtx = (item, i) => (
<figure key={i}>
<figcaption>Enable {item.variant}</figcaption>
<button onClick={() => mtxBuy(item)} disabled={account.balance < item.credits}>¤{item.credits}</button>
</figure>
);
const subscription = account.subscribed const subscription = account.subscribed
? <button ? <button
class="yellow-btn" class="yellow-btn"
@ -90,21 +138,56 @@ function Play(args) {
Subscribe Subscribe
</button>; </button>;
const list = () => {
if (!instances.length) return (
<div class='list play'>
<figure>
<button
class="ready"
onClick={() => sendInstanceQueue()}>
PVP
</button>
<figcaption>Matchmaking</figcaption>
</figure>
{inviteBtn()}
<figure>
<button
class="ready"
onClick={() => sendInstancePractice()}>
Learn
</button>
<figcaption>Practice MNML</figcaption>
</figure>
<figure>
<button
class='discord-btn'
onClick={() => window.open('https://discord.gg/YJJgurM') }>
&nbsp;
</button>
<figcaption>Join the Community</figcaption>
</figure>
</div>
);
return (
<div class='list play rejoin'>
<figure>
<button
class="ready"
onClick={() => sendInstanceState(instances[0].id)}>
Rejoin
</button>
<figcaption>Resume playing</figcaption>
</figure>
</div>
);
}
return ( return (
<section class="top"> <section class="top">
<div class="news"> <div class="news">
<h2>v{VERSION}</h2> <h1>v{VERSION}</h1>
<p class="play-p">Use the buttons on the right to join an instance.</p> {list()}
<p>
Select <b>PVP</b> to play against other players.<br />
Select <b>INVITE</b> then click <b>COPY LINK</b> to generate an instance invitation for a friend.<br />
Click <b>LEARN</b> to practice the game without time controls.
</p>
<p>Join our Discord server to find opponents, message @ntr or @mashy for some credits to get started.</p>
<p>
If you enjoy the game please support its development by <b>subscribing</b> or purchasing <b>credits</b>.<br />
glhf
</p>
</div> </div>
<div> <div>
<h1 class="credits">¤ {account.balance}</h1> <h1 class="credits">¤ {account.balance}</h1>
@ -116,13 +199,18 @@ function Play(args) {
role="link"> role="link">
Get Credits Get Credits
</button> </button>
<div id="error-message"></div>
</div> </div>
<div class='list'> <div>
{shop.owned.map(useMtx)} Join our Discord server to find opponents and talk to the devs. <br />
Message <b>@ntr</b> or <b>@mashy</b> for some credits to get started.<br />
</div> </div>
<div class='list'> <br />
{shop.available.map(availableMtx)} <div>
If you enjoy the game you can support the development:
<ul>
<li>Invite people to play pvp games and grow the community. </li>
<li><b>Subscribe</b> or purchase <b>credits</b>.</li>
</ul>
</div> </div>
</div> </div>
</section> </section>

View File

@ -67,9 +67,11 @@ function Scoreboard(args) {
return ''; return '';
}; };
const winner = player.score === 'Win';
if (!isPlayer) { if (!isPlayer) {
return ( return (
<div class={`player-box top ${player.ready ? 'ready' : ''}`}> <div class={`player-box top ${winner ? 'winner' : player.ready ? 'ready' : ''}`}>
<div></div> <div></div>
<div class="score">{scoreText()}</div> <div class="score">{scoreText()}</div>
<div class="name">{player.name}</div> <div class="name">{player.name}</div>
@ -80,7 +82,7 @@ function Scoreboard(args) {
} }
return ( return (
<div class={`player-box bottom ${player.ready ? 'ready' : ''}`}> <div class={`player-box bottom ${winner ? 'winner': player.ready ? 'ready' : ''}`}>
<div class="msg">{chat || '\u00A0'}</div> <div class="msg">{chat || '\u00A0'}</div>
<div class="score">{scoreText()}</div> <div class="score">{scoreText()}</div>
<div class="name">{player.name}</div> <div class="name">{player.name}</div>

View File

@ -0,0 +1,129 @@
// const { connect } = require('preact-redux');
const preact = require('preact');
const { connect } = require('preact-redux');
const actions = require('./../actions');
const addState = connect(
function receiveState(state) {
const {
ws,
account,
shop,
} = state;
function mtxBuy(mtx) {
return ws.sendMtxBuy(mtx.variant);
}
return {
account,
shop,
mtxBuy,
};
},
function receiveDispatch(dispatch) {
function setMtxActive(mtx) {
dispatch(actions.setConstructRename(null));
dispatch(actions.setMtxActive(mtx));
return true;
}
function setNav(place) {
return dispatch(actions.setNav(place));
}
return {
setMtxActive,
setNav,
};
}
);
function Reshape(args) {
const {
account,
shop,
mtxBuy,
setMtxActive,
setNav,
} = args;
if (!shop) return false;
const useMtx = (item, i) => {
const price = item === 'Rename' ? 5 : 1;
return (
<figure key={i} onClick={e => {
e.stopPropagation();
setMtxActive(item);
}}>
<figcaption>{item}</figcaption>
<button disabled={account.balance === 0}>¤{price}</button>
</figure>
);
};
const availableMtx = (item, i) => (
<figure key={i}>
<figcaption>Enable {item.variant}</figcaption>
<button onClick={() => mtxBuy(item)} disabled={account.balance < item.credits}>¤{item.credits}</button>
</figure>
);
const subscription = account.subscribed
? <button
class="yellow-btn"
disabled>
Subscribed
</button>
: <button
onClick={() => setNav('shop')}
class="yellow-btn"
role="link">
Subscribe
</button>;
return (
<section class="top" onClick={() => setMtxActive(null)}>
<div class="news">
<p class="play-p">Use credits to modify your construct names and appearance.</p>
<ul>
<li> Purchase image sets to unlock different types of avatars. </li>
<li> You can reroll any avatar to a new avatar from owned sets. </li>
<li> Reroll avatars by clicking the owned set and then the construct you wish to reroll. </li>
<li>Press escape to clear any active mtx. </li>
</ul>
<p>
You can switch out your active constructs in the account settings. <br />
Accounts start with 4 constructs by default. <br />
</p>
</div>
<div>
<h1 class="credits">¤ {account.balance}</h1>
<div class='list'>
{subscription}
<button
onClick={() => setNav('shop')}
class="yellow-btn"
role="link">
Get Credits
</button>
<div id="error-message"></div>
</div>
<div class='list'>
{shop.owned.map(useMtx)}
</div>
<div class='list'>
{shop.available.map(availableMtx)}
</div>
</div>
</section>
);
}
module.exports = addState(Reshape);

View File

@ -1,52 +0,0 @@
const preact = require('preact');
const { connect } = require('preact-redux');
const addState = connect(
function receiveState(state) {
const {
ws,
instance
} = state;
return { instance };
},
);
function ScoreBoard(args) {
const {
instance,
} = args;
const players = instance.players.map((p, i) => {
if (instance.phase === 'Finished') {
const winner = p.wins > instance.max_rounds / 2;
return <tr key={i}
class={p.winner ? 'ready' : ''}>
<td>{p.name}</td>
<td>{p.wins} / {p.losses}</td>
<td>{winner ? 'winner' : ''}</td>
</tr>
}
const text = instance.phase === 'Finished'
? p.wins > instance.rounds / 2 && 'Winner'
: '';
return <tr key={i}
class={p.ready ? 'ready' : ''}>
<td>{p.name}</td>
<td>{p.wins} / {p.losses}</td>
<td>{p.ready ? 'ready' : ''}</td>
</tr>
});
return (
<table class="scoreboard">
<tbody>
{players}
</tbody>
</table>
);
}
module.exports = addState(ScoreBoard);

View File

@ -41,7 +41,8 @@ function Shop(args) {
<b>Subscriptions</b> grant extra benefits: <b>Subscriptions</b> grant extra benefits:
<ul> <ul>
<li>¤150 per month</li> <li>¤150 per month</li>
<li>More community features in the future including account icons and chat wheel</li> <li>Account img</li>
<li>Chat wheel</li>
</ul> </ul>
</p> </p>
</div> </div>

View File

@ -97,7 +97,7 @@ function Vbox(args) {
const { const {
combiner, combiner,
navInstance, navInstance,
// instance, instance,
itemInfo, itemInfo,
player, player,
reclaiming, reclaiming,
@ -161,11 +161,20 @@ function Vbox(args) {
function availableBtn(v, group, index) { function availableBtn(v, group, index) {
if (!v) return <button disabled class='empty' >&nbsp;</button>; if (!v) return <button disabled class='empty' >&nbsp;</button>;
const tutorial = instance.time_control === 'Practice'
&& instance.rounds.length === 1
&& group === 0
&& combiner.length === 0
&& vboxSelected.length === 0
&& vbox.bits > 10
&& vbox.free[0].filter(c => c).length > 4
? 'combo-border' : null;
const selected = vboxSelected[0] === group && vboxSelected[1] === index; const selected = vboxSelected[0] === group && vboxSelected[1] === index;
// state not yet set in double click handler // state not yet set in double click handler
function onDblClick(e) { function onDblClick(e) {
clearVboxSelected();
sendVboxAccept(group, index); sendVboxAccept(group, index);
e.stopPropagation(); e.stopPropagation();
} }
@ -194,7 +203,7 @@ function Vbox(args) {
} return false; } return false;
}) ? 'combo-border' : ''; }) ? 'combo-border' : '';
const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''} ${comboHighlight}`; const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''} ${comboHighlight} ${tutorial}`;
if (shapes[v]) { if (shapes[v]) {
return ( return (
@ -267,6 +276,16 @@ function Vbox(args) {
return <button disabled={!inventoryHighlight} class={inventoryHighlight ? 'receiving' : 'empty'} >&nbsp;</button>; return <button disabled={!inventoryHighlight} class={inventoryHighlight ? 'receiving' : 'empty'} >&nbsp;</button>;
} }
const tutorial = instance.time_control === 'Practice'
&& instance.rounds.length === 1
&& i === 0
&& combiner.length === 0
&& vboxSelected.length === 0
&& vbox.bits === 16
&& vbox.bound.length === 5
&& vbox.free[0].filter(c => c).length === 4
? 'combo-border' : null;
const combinerItems = combiner.map(j => vbox.bound[j]); const combinerItems = combiner.map(j => vbox.bound[j]);
const combinerCount = countBy(combinerItems, co => co); const combinerCount = countBy(combinerItems, co => co);
@ -306,7 +325,7 @@ function Vbox(args) {
const highlighted = combiner.indexOf(i) > -1; const highlighted = combiner.indexOf(i) > -1;
const border = buttons[removeTier(v)] ? buttons[removeTier(v)]() : ''; const border = buttons[removeTier(v)] ? buttons[removeTier(v)]() : '';
const classes = `${highlighted ? 'highlight' : border} ${comboHighlight}`; const classes = `${highlighted ? 'highlight' : border} ${comboHighlight} ${tutorial}`;
if (shapes[v]) { if (shapes[v]) {
return ( return (
<button <button
@ -352,6 +371,7 @@ function Vbox(args) {
return true; return true;
})); }));
comboItem = comboItemObj ? comboItemObj.item : 'refine'; comboItem = comboItemObj ? comboItemObj.item : 'refine';
comboItem = comboItem.replace('Plus', '+');
text = `Combine - ${comboItem}`; text = `Combine - ${comboItem}`;
} }

View File

@ -1,172 +0,0 @@
const preact = require('preact');
const range = require('lodash/range');
const { INFO } = require('./../constants');
const { convertItem } = require('../utils');
const shapes = require('./shapes');
const ScoreBoard = require('./scoreboard');
function InfoComponent(args) {
const {
itemInfo,
combiner,
player,
instance,
} = args;
args.info = 'PowerRG';
const { info } = args;
function Info() {
if (!info) return false;
const fullInfo = itemInfo.items.find(i => i.item === info) || INFO[info];
if (!fullInfo) return false;
const isSkill = fullInfo.skill;
const isSpec = fullInfo.spec;
if (isSkill) {
return (
<div class="info-skill">
<h2>{fullInfo.item}</h2>
<div>{fullInfo.description}</div>
</div>
);
}
if (isSpec) {
let red = 0;
let blue = 0;
let green = 0;
player.constructs.forEach(construct => {
red += construct.colours.red;
blue += construct.colours.blue;
green += construct.colours.green;
});
const teamColours = { red, blue, green };
const colourReqs = fullInfo.values.bonuses || [];
const thresholds = colourReqs.map((bonus, i) => {
const colours = ['red', 'green', 'blue'];
const colourGoals = colours.map(c => {
const colourReq = bonus.req[c];
if (colourReqs === 0) return false;
const start = i === 0
? 0
: colourReqs[i - 1].req[c];
const dots = range(start, colourReq).map(j => {
const unmet = teamColours[c] < j + 1;
const reqClass = unmet
? 'unmet'
: '';
return (
<figure key={j} alt={c.colour} class={reqClass} >
{shapes.square([c])}
</figure>
);
});
return (
<div key={c}>
{dots}
</div>
);
});
const reqsMet = colours.every(c => teamColours[c] >= bonus.req[c]);
const reqClass = reqsMet
? ''
: 'unmet';
return (
<div key={i} class="spec-goal">
<div class="colour-reqs">
{colourGoals}
</div>
<div class={reqClass}>
+ {bonus.bonus}
<hr />
</div>
</div>
);
});
return (
<div class="info-spec">
<h2>{info}</h2>
<div>{fullInfo.description}</div>
<div class="thresholds">
{thresholds}
</div>
</div>
);
}
return (
<div class="info-item">
<h2>{fullInfo.item}</h2>
<div>{fullInfo.description}</div>
</div>
);
}
function Combos() {
if (!player) return false;
// show recipe for what's in combiner
if (combiner.some(u => u !== null)) {
const filteredCombos = itemInfo.combos
.filter(combo => combiner.every(u => u === null
|| combo.components.includes(player.vbox.bound[u])));
if (filteredCombos.length > 6) return false;
return (
<table>
<tbody>
{filteredCombos.map((c, i) =>
<tr key={i} >
<td class="highlight" >{convertItem(c.item)}</td>
{c.components.map((u, j) => <td key={j}>{convertItem(u)}</td>)}
</tr>
)}
</tbody>
</table>
);
}
if (!info) return false;
const vboxCombos = itemInfo.combos.filter(c => c.components.includes(info));
if (vboxCombos.length > 6) return false;
return (
<table class="combos">
<tbody>
{vboxCombos.map((c, i) =>
<tr key={i} >
<td class="highlight" >{convertItem(c.item)}</td>
{c.components.map((u, j) => <td key={j} >{convertItem(u)}</td>)}
</tr>
)}
</tbody>
</table>
);
}
const scoreboard = instance.phase === 'Lobby' || info
? null
: <ScoreBoard />;
return (
<div class='info' >
{scoreboard}
<Info />
<Combos />
</div>
);
}
module.exports = InfoComponent;

View File

@ -63,6 +63,7 @@ function Register(args) {
class="login-input" class="login-input"
type="password" type="password"
placeholder="password" placeholder="password"
autocomplete="new-password"
value={this.state.password} value={this.state.password}
onInput={linkState(this, 'password')} onInput={linkState(this, 'password')}
/> />
@ -71,6 +72,7 @@ function Register(args) {
class={`${registerConfirm() ? '' : 'red'} login-input`} class={`${registerConfirm() ? '' : 'red'} login-input`}
type="password" type="password"
placeholder="confirm" placeholder="confirm"
autocomplete="new-password"
value={this.state.confirm} value={this.state.confirm}
onInput={linkState(this, 'confirm')} onInput={linkState(this, 'confirm')}
/> />

View File

@ -28,7 +28,8 @@ function registerEvents(store) {
function setTeam(team) { function setTeam(team) {
store.dispatch(actions.setTeam(team)); store.dispatch(actions.setTeam(team));
setNav('play'); const { nav } = store.getState();
if (nav !== 'reshape') setNav('play');
} }
function setSubscription(sub) { function setSubscription(sub) {
@ -179,6 +180,7 @@ function registerEvents(store) {
} }
function setAccountInstances(v) { function setAccountInstances(v) {
store.dispatch(actions.setMtxActive(null));
return store.dispatch(actions.setInstances(v)); return store.dispatch(actions.setInstances(v));
} }

View File

@ -259,7 +259,7 @@ function createSocket(events) {
QueueRequested: () => events.notify('pvp queue request received'), QueueRequested: () => events.notify('pvp queue request received'),
QueueJoined: () => events.notify('you have joined the pvp queue'), QueueJoined: () => events.notify('you have joined the pvp queue'),
InviteRequested: () => events.notify('pvp queue request received'), InviteRequested: () => events.notify('pvp invite request received'),
Invite: code => events.setInvite(code), Invite: code => events.setInvite(code),
InstanceChat: chat => events.setInstanceChat(chat), InstanceChat: chat => events.setInstanceChat(chat),
ChatWheel: wheel => events.setChatWheel(wheel), ChatWheel: wheel => events.setChatWheel(wheel),

View File

@ -1,6 +1,6 @@
{ {
"name": "mnml-ops", "name": "mnml-ops",
"version": "1.6.2", "version": "1.6.3",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
[package] [package]
name = "mnml" name = "mnml"
version = "1.6.2" version = "1.6.3"
authors = ["ntr <ntr@smokestack.io>"] authors = ["ntr <ntr@smokestack.io>"]
[dependencies] [dependencies]

View File

@ -377,9 +377,11 @@ impl Game {
let mut sorted = self.stack.clone(); let mut sorted = self.stack.clone();
sorted.iter_mut() sorted.iter_mut()
.for_each(|s| { .for_each(|s| {
if !s.skill.is_tick() {
let caster = self.construct_by_id(s.source_construct_id).unwrap(); let caster = self.construct_by_id(s.source_construct_id).unwrap();
let speed = caster.skill_speed(s.skill); let speed = caster.skill_speed(s.skill);
s.speed = speed; s.speed = speed;
}
}); });
sorted.sort_unstable_by_key(|s| s.speed); sorted.sort_unstable_by_key(|s| s.speed);

View File

@ -81,7 +81,7 @@ impl TimeControl {
pub fn lobby_timeout(&self) -> DateTime<Utc> { pub fn lobby_timeout(&self) -> DateTime<Utc> {
Utc::now() Utc::now()
.checked_add_signed(Duration::seconds(30)) .checked_add_signed(Duration::seconds(15))
.expect("could not set phase end") .expect("could not set phase end")
} }

View File

@ -384,7 +384,7 @@ impl Cast {
source_player_id: source.account, source_player_id: source.account,
target_construct_id: target.id, target_construct_id: target.id,
skill, skill,
speed: 0, speed: source.skill_speed(skill),
} }
} }
@ -1499,7 +1499,13 @@ fn heal(source: &mut Construct, target: &mut Construct, mut results: Resolutions
} }
fn triage(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions { fn triage(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
let skip_tick = target.effects.iter().any(|e| e.effect == Effect::Triage); let skip_tick = target.effects.iter().any(|e| {
match e.effect {
Effect::Triage => source.skill_speed(skill) <= e.tick.unwrap().speed,
_ => false,
}
});
let ConstructEffect { effect, duration, meta, tick: _ } = skill.effect()[0]; let ConstructEffect { effect, duration, meta, tick: _ } = skill.effect()[0];
let tick_skill = match meta { let tick_skill = match meta {
Some(EffectMeta::Skill(s)) => s, Some(EffectMeta::Skill(s)) => s,
@ -1565,7 +1571,12 @@ fn decay(source: &mut Construct, target: &mut Construct, mut results: Resolution
let wither = skill.effect()[0]; let wither = skill.effect()[0];
results.push(Resolution::new(source, target).event(target.add_effect(skill, wither))); results.push(Resolution::new(source, target).event(target.add_effect(skill, wither)));
let skip_tick = target.effects.iter().any(|e| e.effect == Effect::Decay); let skip_tick = target.effects.iter().any(|e| {
match e.effect {
Effect::Decay => source.skill_speed(skill) <= e.tick.unwrap().speed,
_ => false,
}
});
let ConstructEffect { effect, duration, meta, tick: _ } = skill.effect()[1]; let ConstructEffect { effect, duration, meta, tick: _ } = skill.effect()[1];
let tick_skill = match meta { let tick_skill = match meta {
Some(EffectMeta::Skill(s)) => s, Some(EffectMeta::Skill(s)) => s,
@ -1619,7 +1630,12 @@ fn electrocute(source: &mut Construct, target: &mut Construct, mut results: Reso
_ => panic!("no electrocute tick skill"), _ => panic!("no electrocute tick skill"),
}; };
let skip_tick = target.effects.iter().any(|e| e.effect == Effect::Electrocute); let skip_tick = target.effects.iter().any(|e| {
match e.effect {
Effect::Electrocute => source.skill_speed(skill) <= e.tick.unwrap().speed,
_ => false,
}
});
let electrocute = ConstructEffect::new(effect, duration).set_tick(Cast::new_tick(source, target, tick_skill)); let electrocute = ConstructEffect::new(effect, duration).set_tick(Cast::new_tick(source, target, tick_skill));
results.push(Resolution::new(source, target) results.push(Resolution::new(source, target)
.event(target.add_effect(skill, electrocute)) .event(target.add_effect(skill, electrocute))
@ -1716,7 +1732,12 @@ fn recharge(source: &mut Construct, target: &mut Construct, mut results: Resolut
fn siphon(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions { fn siphon(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
let skip_tick = target.effects.iter().any(|e| e.effect == Effect::Siphon); let skip_tick = target.effects.iter().any(|e| {
match e.effect {
Effect::Siphon => source.skill_speed(skill) <= e.tick.unwrap().speed,
_ => false,
}
});
let ConstructEffect { effect, duration, meta, tick: _ } = skill.effect()[0]; let ConstructEffect { effect, duration, meta, tick: _ } = skill.effect()[0];
let tick_skill = match meta { let tick_skill = match meta {
Some(EffectMeta::Skill(s)) => s, Some(EffectMeta::Skill(s)) => s,