From 8992fed59143c85eb08c58972002f917f3c5e8c0 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 23 Sep 2019 13:54:06 +1000 Subject: [PATCH 01/11] don't create account img on register --- server/src/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/account.rs b/server/src/account.rs index 10e0138f..11776a4b 100644 --- a/server/src/account.rs +++ b/server/src/account.rs @@ -348,7 +348,7 @@ pub fn create(name: &String, password: &String, tx: &mut Transaction) -> Result< .insert(tx)?; } - img::shapes_write(img)?; + // img::shapes_write(img)?; info!("registration account={:?}", name); From f6ff6d37e3b0890fd00d84ef4cbce7a8d2c163af Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 23 Sep 2019 14:11:40 +1000 Subject: [PATCH 02/11] patch uuid generator into migrations --- client/src/components/welcome.about.jsx | 69 --------------------- ops/migrations/20190914191207_shapes-mtx.js | 4 ++ 2 files changed, 4 insertions(+), 69 deletions(-) delete mode 100644 client/src/components/welcome.about.jsx diff --git a/client/src/components/welcome.about.jsx b/client/src/components/welcome.about.jsx deleted file mode 100644 index 0f33b942..00000000 --- a/client/src/components/welcome.about.jsx +++ /dev/null @@ -1,69 +0,0 @@ -// eslint-disable-next-line -const preact = require('preact'); -const { Component } = require('preact') -const { connect } = require('preact-redux'); -const linkState = require('linkstate').default; - -const { postData, errorToast, infoToast } = require('../utils'); - -const addState = connect( - (state) => { - const { - ws - } = state; - - function submitRegister(name, password, code) { - postData('/account/register', { name, password, code }) - .then(res => res.json()) - .then(data => { - if (data.error) return errorToast(data.error); - infoToast(data.message); - ws.connect(); - }) - .catch(error => errorToast(error)); - } - - return { - submitRegister, - } - }, -); - -function Register(args) { - const { - submitRegister, - navRegister, - } = args; - - return ( - - ); -} - -module.exports = addState(Register); diff --git a/ops/migrations/20190914191207_shapes-mtx.js b/ops/migrations/20190914191207_shapes-mtx.js index 4d7f5e3c..34f56d52 100644 --- a/ops/migrations/20190914191207_shapes-mtx.js +++ b/ops/migrations/20190914191207_shapes-mtx.js @@ -2,6 +2,10 @@ const uuidv4 = require('uuid/v4'); // give everybody the shapes mtx exports.up = async knex => { + await knex.raw(` + CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; + `); + await knex.raw(` INSERT INTO mtx (id, account, variant) SELECT uuid_generate_v4() as id, id as account, 'Shapes' From 6997a7a7c9d0c3714d9a7d98cf266a96c584c4f8 Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 23 Sep 2019 14:23:22 +1000 Subject: [PATCH 03/11] item descriptions and worklog --- WORKLOG.md | 88 ++++++++++++++++++++++------------------------ server/src/item.rs | 16 ++++----- 2 files changed, 51 insertions(+), 53 deletions(-) diff --git a/WORKLOG.md b/WORKLOG.md index f4230f25..8f93a003 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -1,65 +1,56 @@ # WORK WORK -## NOW -*PRODUCTION* -* ACP - * essential - * serde serialize privatise - * mobile styles - * can't reset password without knowing password =\ +## NOW (Before PAX) - * treats - * client animation bpm - * background colour changes depending on time of day - * susbcriber gold name in instance +*PRODUCTION* + +* mobile styles +* mobile info page + +* Add TOS and accept to register page + +* can't reset password without knowing password =\ + +## SOON (Before or After PAX) * bot game grind - -* msg pane - +* ACP + * essential + * serde serialize privatise +* msg pane / chatwheel * audio - -## SOON -*SERVER* -* modules - * troll life -> dmg - * prince of peace - * bonus healing / no damage - * fuck magic - * empower on ko + * treats + * susbcriber gold name in instance + * client animation bpm + * background colour changes depending on time of day * rework vecs into sets * remove names so games/instances are copy *$$$* -* chatwheel -* eth adapter -* illusions -* vaporwave -* crop circles -* insects -* sacred geometry -* skulls / day of the dead -* Aztec -* youkai -* Industrial + * chatwheel + * eth adapter + * illusions + * vaporwave + * crop circles + * insects + * sacred geometry + * skulls / day of the dead + * Aztec + * youkai + * Industrial *CLIENT* -fix info highlighting -theme toasts -mobile info page -reconnect based on time delta -consolidate game and instance + theme toasts -*SERVER* -* vbox drops chances - * 50% spec, 25% colour etc + reconnect based on time delta + consolidate game and instance -* mnml tv + * elo + leaderboards + + * mnml tv ## LATER -* elo + leaderboards * constants -* change to ownership pattern $$$ * Items @@ -69,6 +60,13 @@ $$$ * Highlight (dota) colour * fx colours + styles +* modules + * troll life -> dmg + * prince of peace + * bonus healing / no damage + * fuck magic + * empower on ko + # Mechanics * 10d chaos maths, not rock paper scissors * phys is faster and chaotic diff --git a/server/src/item.rs b/server/src/item.rs index 581c6b5f..95734c38 100644 --- a/server/src/item.rs +++ b/server/src/item.rs @@ -737,8 +737,8 @@ impl Item { Item::Electrify| Item::ElectrifyPlus | Item::ElectrifyPlusPlus => format!( - "Self targetting defensive for {:?}T. Applies Electric to attackers dealing BlueDamage {:?}% \ - BluePower per turn for {:?}T.", + "Applies electrify for {:?}T. If a construct with electrify takes damage they will apply an electrocute debuff to the caster dealing {:?}% \ + BluePower as BlueDamage per turn for {:?}T.", self.into_skill().unwrap().effect()[0].get_duration(), self.into_skill().unwrap().effect()[0].get_skill().unwrap().effect()[0].get_skill().unwrap().multiplier(), self.into_skill().unwrap().effect()[0].get_skill().unwrap().effect()[0].get_duration()), @@ -790,20 +790,20 @@ impl Item { Item::Invert| Item::InvertPlus | Item::InvertPlusPlus => format!( - "Reverse healing into damage and damage into healing. - Any excess red or blue damage is converted into shield recharge."), + "Reverse healing into damage and damage into healing. Any excess red or blue damage is converted into shield recharge. Lasts {:?}T.", + self.into_skill().unwrap().effect()[0].get_duration()), Item::Counter| Item::CounterPlus | - Item::CounterPlusPlus => format!("Self targetting skill. Recharges RedLife for {:?}% RedPower and blocks red skills for {:?}T. - If a red skill is parried the construct will riposte the source dealing {:?}% RedPower as red damage.", - self.into_skill().unwrap().multiplier(), + Item::CounterPlusPlus => format!("Applies counter and block {:?}T. Block reduces incoming red damage by {:?}%. + Red damage taken during counter will trigger a counter attack dealing {:?}% RedPower as red damage.", self.into_skill().unwrap().effect()[0].get_duration(), + 100 - self.into_skill().unwrap().effect()[1].get_multiplier(), self.into_skill().unwrap().effect()[0].get_skill().unwrap().multiplier()), Item::Purge| Item::PurgePlus | - Item::PurgePlusPlus => format!("Remove buffs from target construct. Applies purge which disables target green skills for {:?}T.", + Item::PurgePlusPlus => format!("Remove buffs from target construct. Applies purge disabling target green skills for {:?}T.", self.into_skill().unwrap().effect()[0].get_duration()), Item::Purify| From 58ff97a0714df736c8f69c440641dc00c00feec7 Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 23 Sep 2019 15:31:05 +1000 Subject: [PATCH 04/11] remove spec multi --- server/src/construct.rs | 18 +++--- server/src/spec.rs | 125 +++++++++++++++++++--------------------- 2 files changed, 67 insertions(+), 76 deletions(-) diff --git a/server/src/construct.rs b/server/src/construct.rs index 21647aef..fae3f1e7 100644 --- a/server/src/construct.rs +++ b/server/src/construct.rs @@ -145,7 +145,7 @@ impl ConstructStat { // self.recalculate(specs) // } - pub fn recalculate(&mut self, specs: &Vec, construct_colours: &Colours, player_colours: &Colours) -> &mut ConstructStat { + pub fn recalculate(&mut self, specs: &Vec, player_colours: &Colours) -> &mut ConstructStat { let specs = specs .iter() .filter(|s| s.affects().contains(&self.stat)) @@ -154,7 +154,7 @@ impl ConstructStat { // applied with fold because it can be zeroed or multiplied // but still needs access to the base amount - let value = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base, construct_colours, player_colours)); + let value = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base, player_colours)); self.value = value; self.max = value; @@ -325,14 +325,14 @@ impl Construct { pub fn apply_modifiers(&mut self, player_colours: &Colours) -> &mut Construct { self.specs.sort_unstable(); - self.red_power.recalculate(&self.specs, &self.colours, player_colours); - self.red_life.recalculate(&self.specs, &self.colours, player_colours); - self.blue_power.recalculate(&self.specs, &self.colours, player_colours); - self.blue_life.recalculate(&self.specs, &self.colours, player_colours); + self.red_power.recalculate(&self.specs, player_colours); + self.red_life.recalculate(&self.specs, player_colours); + self.blue_power.recalculate(&self.specs, player_colours); + self.blue_life.recalculate(&self.specs, player_colours); // self.evasion.recalculate(&self.specs, &self.colours, player_colours); - self.speed.recalculate(&self.specs, &self.colours, player_colours); - self.green_power.recalculate(&self.specs, &self.colours, player_colours); - self.green_life.recalculate(&self.specs, &self.colours, player_colours); + self.speed.recalculate(&self.specs, player_colours); + self.green_power.recalculate(&self.specs, player_colours); + self.green_life.recalculate(&self.specs, player_colours); self } diff --git a/server/src/spec.rs b/server/src/spec.rs index 28a842f7..53a7c27f 100644 --- a/server/src/spec.rs +++ b/server/src/spec.rs @@ -19,7 +19,6 @@ impl SpecBonus { #[derive(Debug,Clone,Serialize,Deserialize)] pub struct SpecValues { pub base: u64, - pub multi: u64, pub bonuses: Vec, } @@ -31,12 +30,6 @@ impl SpecValues { pub fn base (self) -> u64 { self.base } - -/* - pub fn calc_multi (&self, c: &Colours) -> u64 { - self.multi * (c.red + c.green + c.blue) as u64 - } -*/ } @@ -149,8 +142,6 @@ impl Spec { Spec::SpeedGBPlusPlus => vec![Stat::Speed], Spec::SpeedRBPlusPlus => vec![Stat::Speed], - - Spec::Life => vec![Stat::GreenLife], Spec::LifeRR => vec![Stat::RedLife], Spec::LifeBB => vec![Stat::BlueLife], @@ -176,12 +167,12 @@ impl Spec { pub fn values(&self) -> SpecValues { match *self { Spec::Power => SpecValues { - multi: 0, base: 10, + base: 10, bonuses: vec![] }, Spec::PowerRR=> SpecValues { - multi: 10, base: 25, + base: 25, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 25 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 25 }, @@ -190,7 +181,7 @@ impl Spec { }, Spec::PowerGG=> SpecValues { - multi: 10, base: 25, + base: 25, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 25 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 25 }, @@ -199,7 +190,7 @@ impl Spec { }, Spec::PowerBB=> SpecValues { - multi: 10, base: 25, + base: 25, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 25 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 25 }, @@ -208,7 +199,7 @@ impl Spec { }, Spec::PowerRG=> SpecValues { - multi: 5, base: 15, + base: 15, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 15 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 15 }, @@ -217,7 +208,7 @@ impl Spec { }, Spec::PowerGB=> SpecValues { - multi: 5, base: 15, + base: 15, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 15 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 15 }, @@ -226,7 +217,7 @@ impl Spec { }, Spec::PowerRB=> SpecValues { - multi: 5, base: 15, + base: 15, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 15 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 15 }, @@ -235,7 +226,7 @@ impl Spec { }, Spec::PowerRRPlus => SpecValues { - multi: 10, base: 40, + base: 40, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 40 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 40 }, @@ -244,7 +235,7 @@ impl Spec { }, Spec::PowerGGPlus => SpecValues { - multi: 10, base: 40, + base: 40, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 40 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 40 }, @@ -253,7 +244,7 @@ impl Spec { }, Spec::PowerBBPlus => SpecValues { - multi: 10, base: 40, + base: 40, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 40 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 40 }, @@ -262,7 +253,7 @@ impl Spec { }, Spec::PowerRGPlus => SpecValues { - multi: 7, base: 25, + base: 25, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 25 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 25 }, @@ -271,7 +262,7 @@ impl Spec { }, Spec::PowerGBPlus => SpecValues { - multi: 7, base: 25, + base: 25, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 25 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 25 }, @@ -280,7 +271,7 @@ impl Spec { }, Spec::PowerRBPlus => SpecValues { - multi: 7, base: 25, + base: 25, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 25 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 25 }, @@ -288,7 +279,7 @@ impl Spec { ], }, Spec::PowerRRPlusPlus => SpecValues { - multi: 20, base: 60, + base: 60, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 60 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 60 }, @@ -297,7 +288,7 @@ impl Spec { }, Spec::PowerGGPlusPlus => SpecValues { - multi: 20, base: 60, + base: 60, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 60 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 60 }, @@ -306,7 +297,7 @@ impl Spec { }, Spec::PowerBBPlusPlus => SpecValues { - multi: 20, base: 60, + base: 60, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 60 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 60 }, @@ -315,7 +306,7 @@ impl Spec { }, Spec::PowerRGPlusPlus => SpecValues { - multi: 20, base: 40, + base: 40, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 40 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 40 }, @@ -324,7 +315,7 @@ impl Spec { }, Spec::PowerGBPlusPlus => SpecValues { - multi: 20, base: 40, + base: 40, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 25 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 25 }, @@ -333,7 +324,7 @@ impl Spec { }, Spec::PowerRBPlusPlus => SpecValues { - multi: 20, base: 40, + base: 40, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 25 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 25 }, @@ -342,12 +333,12 @@ impl Spec { }, Spec::Speed => SpecValues { - multi: 0, base: 40, + base: 40, bonuses: vec![] }, Spec::SpeedRR=> SpecValues { - multi: 20, base: 80, + base: 80, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 80 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 80 }, @@ -356,7 +347,7 @@ impl Spec { }, Spec::SpeedGG=> SpecValues { - multi: 20, base: 80, + base: 80, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 80 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 80 }, @@ -365,7 +356,7 @@ impl Spec { }, Spec::SpeedBB=> SpecValues { - multi: 20, base: 80, + base: 80, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 80 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 80 }, @@ -374,7 +365,7 @@ impl Spec { }, Spec::SpeedRG=> SpecValues { - multi: 15, base: 60, + base: 60, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 60 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 60 }, @@ -383,7 +374,7 @@ impl Spec { }, Spec::SpeedGB=> SpecValues { - multi: 15, base: 60, + base: 60, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 60 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 60 }, @@ -392,7 +383,7 @@ impl Spec { }, Spec::SpeedRB=> SpecValues { - multi: 15, base: 60, + base: 60, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 60 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 60 }, @@ -401,7 +392,7 @@ impl Spec { }, Spec::SpeedRRPlus => SpecValues { - multi: 20, base: 120, + base: 120, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 120 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 120 }, @@ -410,7 +401,7 @@ impl Spec { }, Spec::SpeedGGPlus => SpecValues { - multi: 20, base: 120, + base: 120, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 120 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 120 }, @@ -419,7 +410,7 @@ impl Spec { }, Spec::SpeedBBPlus => SpecValues { - multi: 20, base: 120, + base: 120, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 120 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 120 }, @@ -428,7 +419,7 @@ impl Spec { }, Spec::SpeedRGPlus => SpecValues { - multi: 15, base: 80, + base: 80, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 80 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 80 }, @@ -437,7 +428,7 @@ impl Spec { }, Spec::SpeedGBPlus => SpecValues { - multi: 15, base: 80, + base: 80, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 80 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 80 }, @@ -446,7 +437,7 @@ impl Spec { }, Spec::SpeedRBPlus => SpecValues { - multi: 15, base: 80, + base: 80, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 80 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 80 }, @@ -455,7 +446,7 @@ impl Spec { }, Spec::SpeedRRPlusPlus => SpecValues { - multi: 20, base: 160, + base: 160, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 160 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 160 }, @@ -464,7 +455,7 @@ impl Spec { }, Spec::SpeedGGPlusPlus => SpecValues { - multi: 20, base: 160, + base: 160, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 160 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 160 }, @@ -473,7 +464,7 @@ impl Spec { }, Spec::SpeedBBPlusPlus => SpecValues { - multi: 20, base: 160, + base: 160, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 160 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 160 }, @@ -482,7 +473,7 @@ impl Spec { }, Spec::SpeedRGPlusPlus => SpecValues { - multi: 15, base: 120, + base: 120, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 120 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 120 }, @@ -491,7 +482,7 @@ impl Spec { }, Spec::SpeedGBPlusPlus => SpecValues { - multi: 15, base: 120, + base: 120, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 120 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 120 }, @@ -500,7 +491,7 @@ impl Spec { }, Spec::SpeedRBPlusPlus => SpecValues { - multi: 15, base: 120, + base: 120, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 120 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 120 }, @@ -509,11 +500,11 @@ impl Spec { }, Spec::Life => SpecValues { - multi: 0, base: 100, + base: 100, bonuses: vec![]}, Spec::LifeRR=> SpecValues { - multi: 50, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 100 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 100 }, @@ -522,7 +513,7 @@ impl Spec { }, Spec::LifeGG=> SpecValues { - multi: 50, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 100 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 100 }, @@ -531,7 +522,7 @@ impl Spec { }, Spec::LifeBB=> SpecValues { - multi: 50, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 100 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 100 }, @@ -540,7 +531,7 @@ impl Spec { }, Spec::LifeRG=> SpecValues { - multi: 40, base: 150, + base: 150, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 75 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 75 }, @@ -549,7 +540,7 @@ impl Spec { }, Spec::LifeGB=> SpecValues { - multi: 40, base: 150, + base: 150, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 75 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 75 }, @@ -558,7 +549,7 @@ impl Spec { }, Spec::LifeRB=> SpecValues { - multi: 40, base: 150, + base: 150, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 75 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 75 }, @@ -567,7 +558,7 @@ impl Spec { }, Spec::LifeRRPlus => SpecValues { - multi: 50, base: 300, + base: 300, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 150 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 150 }, @@ -576,7 +567,7 @@ impl Spec { }, Spec::LifeGGPlus => SpecValues { - multi: 50, base: 300, + base: 300, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 150 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 150 }, @@ -585,7 +576,7 @@ impl Spec { }, Spec::LifeBBPlus => SpecValues { - multi: 50, base: 300, + base: 300, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 150 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 150 }, @@ -594,7 +585,7 @@ impl Spec { }, Spec::LifeRGPlus => SpecValues { - multi: 40, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 100 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 100 }, @@ -603,7 +594,7 @@ impl Spec { }, Spec::LifeGBPlus => SpecValues { - multi: 40, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 100 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 100 }, @@ -612,7 +603,7 @@ impl Spec { }, Spec::LifeRBPlus => SpecValues { - multi: 40, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 100 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 100 }, @@ -620,7 +611,7 @@ impl Spec { ], }, Spec::LifeRRPlusPlus => SpecValues { - multi: 40, base: 300, + base: 300, bonuses: vec![ SpecBonus { req: Colours { red: 5, green: 0, blue: 0 }, bonus: 300 }, SpecBonus { req: Colours { red: 10, green: 0, blue: 0 }, bonus: 300 }, @@ -629,7 +620,7 @@ impl Spec { }, Spec::LifeGGPlusPlus => SpecValues { - multi: 40, base: 300, + base: 300, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 5, blue: 0 }, bonus: 300 }, SpecBonus { req: Colours { red: 0, green: 10, blue: 0 }, bonus: 300 }, @@ -638,7 +629,7 @@ impl Spec { }, Spec::LifeBBPlusPlus => SpecValues { - multi: 40, base: 300, + base: 300, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 0, blue: 5 }, bonus: 300 }, SpecBonus { req: Colours { red: 0, green: 0, blue: 10 }, bonus: 300 }, @@ -647,7 +638,7 @@ impl Spec { }, Spec::LifeRGPlusPlus => SpecValues { - multi: 40, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 2, blue: 0 }, bonus: 200 }, SpecBonus { req: Colours { red: 5, green: 5, blue: 0 }, bonus: 200 }, @@ -656,7 +647,7 @@ impl Spec { }, Spec::LifeGBPlusPlus => SpecValues { - multi: 40, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 200 }, SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 200 }, @@ -665,7 +656,7 @@ impl Spec { }, Spec::LifeRBPlusPlus => SpecValues { - multi: 40, base: 200, + base: 200, bonuses: vec![ SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 200 }, SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 200 }, @@ -675,7 +666,7 @@ impl Spec { } } - pub fn apply(&self, modified: u64, base: u64, construct_colours: &Colours, player_colours: &Colours) -> u64 { + pub fn apply(&self, modified: u64, base: u64, player_colours: &Colours) -> u64 { match *self { // Percentage multipliers based on base value Spec::Power | From c2120a602b0ac67181ee34dc192ccbec2c8594c1 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 23 Sep 2019 21:30:01 +1000 Subject: [PATCH 05/11] mobile styles --- client/assets/styles/footer.less | 1 + client/assets/styles/game.less | 69 +++++++++++++++++--------- client/assets/styles/styles.mobile.css | 3 +- server/src/events.rs | 2 +- 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/client/assets/styles/footer.less b/client/assets/styles/footer.less index 8ab8873a..cf9b6012 100644 --- a/client/assets/styles/footer.less +++ b/client/assets/styles/footer.less @@ -6,6 +6,7 @@ footer { button { margin: 0; + border-radius: 0; border: none; background: #222; font-size: 1.5em; diff --git a/client/assets/styles/game.less b/client/assets/styles/game.less index 0a71051c..a8765ba5 100644 --- a/client/assets/styles/game.less +++ b/client/assets/styles/game.less @@ -317,37 +317,58 @@ grid-template-rows: 1fr 0.2fr 1.5fr; grid-template-columns: 1fr; - } - .game .stats div { - padding: 0; - } + .game-construct { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: min-content 1fr; - .game .stats .max { - display: none; - } + .left { + grid-template-rows: min-content min-content; + } - .game .stats .value { - display: flex; - } + .skills { + button { + padding: 0 0.5em ; + margin: 0; + } + } - .game .stats svg { - height: 1em; - } + .stats div { + padding: 0; + } - .game .stats div { - margin: 0 0.2em; - } + .stats .max { + display: none; + } - .game .effects { - font-size: 100%; - } + .stats .value { + display: flex; + } - #mnml .game .skills button, #mnml .game .stats { - font-size: 75%; - } + .stats svg { + height: 1em; + } - .game-construct .name { - display: none; + .stats div { + margin: 0 0.2em; + } + + .effects { + font-size: 100%; + } + + .skills button, .stats, .name { + font-size: 75%; + } + } + + .opponent { + .game-construct { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: min-content 1fr; + } + } } } \ No newline at end of file diff --git a/client/assets/styles/styles.mobile.css b/client/assets/styles/styles.mobile.css index 6b09a6c7..4ff0b321 100644 --- a/client/assets/styles/styles.mobile.css +++ b/client/assets/styles/styles.mobile.css @@ -1,9 +1,10 @@ @media (max-width: 800px) { #mnml { - font-size: 14pt; + font-size: 12pt; padding: 1em 0 0 0; grid-template-columns: 1fr; grid-template-rows: 1fr min-content; + overflow-y: scroll; grid-template-areas: "main" "footer"; diff --git a/server/src/events.rs b/server/src/events.rs index ad3d898f..9902991e 100644 --- a/server/src/events.rs +++ b/server/src/events.rs @@ -263,7 +263,7 @@ impl Events { None => false, }) .map(|(_id, c)| PvpRequest { id: c.id, account: c.account.unwrap(), tx: c.tx.clone() }) - .ok_or(format_err!("invite not found code={:?}", code))?; + .ok_or(format_err!("invite expired code={:?}", code))?; let join = PvpRequest { id: c.id, account: c.account.unwrap(), tx: c.tx.clone() }; From 5fb44ee226e9124d10af2ac805a949d6d3b211b3 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 23 Sep 2019 21:42:54 +1000 Subject: [PATCH 06/11] vbox --- client/assets/styles/instance.mobile.css | 5 +++-- client/assets/styles/styles.less | 4 +++- client/assets/styles/styles.mobile.css | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/assets/styles/instance.mobile.css b/client/assets/styles/instance.mobile.css index 52eceb82..d3761706 100644 --- a/client/assets/styles/instance.mobile.css +++ b/client/assets/styles/instance.mobile.css @@ -17,15 +17,16 @@ .instance .construct-list { display: none; } .vbox { grid-area: vbox; + margin-bottom: 0; display: grid; - grid-template-rows: min-content min-content min-content min-content min-content; + grid-template-rows: min-content min-content min-content min-content; grid-template-columns: 1fr; grid-template-areas: "vbox" "varrow" "inventory" - "carrow" "combiner"; + } .vbox-arrow { diff --git a/client/assets/styles/styles.less b/client/assets/styles/styles.less index c512bf0f..004ffef9 100644 --- a/client/assets/styles/styles.less +++ b/client/assets/styles/styles.less @@ -1,6 +1,6 @@ @import 'colours.less'; -html, body, #mnml { +html body { margin: 0; background-color: black; @@ -12,7 +12,9 @@ html, body, #mnml { -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; +} +#mnml { /* this is the sweet nectar to keep it full page*/ height: 100vh; max-height: 100vh; diff --git a/client/assets/styles/styles.mobile.css b/client/assets/styles/styles.mobile.css index 4ff0b321..1eb5963d 100644 --- a/client/assets/styles/styles.mobile.css +++ b/client/assets/styles/styles.mobile.css @@ -1,10 +1,11 @@ @media (max-width: 800px) { + #mnml { font-size: 12pt; - padding: 1em 0 0 0; + padding: 0; grid-template-columns: 1fr; grid-template-rows: 1fr min-content; - overflow-y: scroll; + /*overflow-y: scroll;*/ grid-template-areas: "main" "footer"; From b681c9218a7641f3dc321c7759eb6f5bb367859a Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 24 Sep 2019 12:29:05 +1000 Subject: [PATCH 07/11] ??? --- client/assets/styles/instance.mobile.css | 12 +- client/src/components/footer.jsx | 6 +- client/src/components/game.footer.jsx | 27 +---- client/src/components/instance.footer.jsx | 11 +- client/src/components/list.footer.jsx | 48 -------- client/src/components/play.footer.jsx | 139 ++++++++++++++++++++++ server/src/names.rs | 8 +- 7 files changed, 156 insertions(+), 95 deletions(-) delete mode 100644 client/src/components/list.footer.jsx create mode 100644 client/src/components/play.footer.jsx diff --git a/client/assets/styles/instance.mobile.css b/client/assets/styles/instance.mobile.css index d3761706..acc33451 100644 --- a/client/assets/styles/instance.mobile.css +++ b/client/assets/styles/instance.mobile.css @@ -61,11 +61,8 @@ } .instance.constructs-visible .construct-list { - display: flex; - flex-flow: row; - align-content: flex-end; - height: 100%; - margin: 0; + display: grid; + grid-auto-rows: 1fr; } .vbox-inventory { @@ -88,7 +85,6 @@ } .instance-construct { - flex: 1; display: grid; grid-template-rows: min-content min-content min-content 1fr min-content; grid-template-areas: @@ -107,10 +103,6 @@ transition-timing-function: ease; } - .instance-construct .avatar { - min-height: 150px; - } - .instance-construct:first-child { border-left-width: 0; } diff --git a/client/src/components/footer.jsx b/client/src/components/footer.jsx index edad7dd2..07b3caa3 100644 --- a/client/src/components/footer.jsx +++ b/client/src/components/footer.jsx @@ -5,7 +5,7 @@ const { connect } = require('preact-redux'); const actions = require('./../actions'); const TeamFooter = require('./team.footer'); -const ListFooter = require('./list.footer'); +const PlayFooter = require('./play.footer'); const InstanceFooter = require('./instance.footer'); const GameFooter = require('./game.footer'); @@ -30,8 +30,8 @@ function renderHeader(args) { if (game) return ; if (instance) return ; - if (nav === 'team') return ; - if (nav === 'list') return ; + if (nav === 'team' || nav === 'account') return ; + if (nav === 'play' || nav === 'shop' || !nav) return ; } diff --git a/client/src/components/game.footer.jsx b/client/src/components/game.footer.jsx index 1daa4981..40095d45 100644 --- a/client/src/components/game.footer.jsx +++ b/client/src/components/game.footer.jsx @@ -9,7 +9,7 @@ const addState = connect( ws, game, account, - showNav, + animating, } = state; function sendGameReady() { @@ -24,9 +24,9 @@ const addState = connect( return { game, account, + animating, sendInstanceState, sendGameReady, - showNav, }; }, @@ -36,15 +36,7 @@ const addState = connect( dispatch(actions.setInstance(null)); } - function skip() { - dispatch(actions.setSkip(true)); - } - - function setShowNav(v) { - return dispatch(actions.setShowNav(v)); - } - - return { setShowNav, quit, skip }; + return { quit }; } ); @@ -53,22 +45,13 @@ function GameFooter(props) { const { game, account, - showNav, + animating, quit, - setShowNav, sendGameReady, sendInstanceState, } = props; - if (!game) { - return ( -
- -
- ); - } - const playerTeam = game.players.find(t => t.id === account.id); function quitClick() { @@ -86,6 +69,7 @@ function GameFooter(props) { const readyBtn = ( {game.phase === 'Finish' && quitBtn } {game.phase === 'Skill' && readyBtn } diff --git a/client/src/components/instance.footer.jsx b/client/src/components/instance.footer.jsx index ee8cf2c3..4a01e943 100644 --- a/client/src/components/instance.footer.jsx +++ b/client/src/components/instance.footer.jsx @@ -5,20 +5,16 @@ const actions = require('../actions'); const addState = connect( function receiveState(state) { - const { ws, instance, player, nav, showNav } = state; + const { ws, instance, player, nav } = state; function sendInstanceReady() { return ws.sendInstanceReady(instance.id); } - return { player, instance, sendInstanceReady, nav, showNav }; + return { player, instance, sendInstanceReady, nav }; }, function receiveDispatch(dispatch) { - function setShowNav(v) { - return dispatch(actions.setShowNav(v)); - } - function setInfo(c) { return dispatch(actions.setInfo(c)); } @@ -30,7 +26,6 @@ const addState = connect( return { setInfo, setNav, - setShowNav, }; } ); @@ -44,7 +39,6 @@ function Instance(args) { setInfo, setNav, - setShowNav, sendInstanceReady, } = args; @@ -118,7 +112,6 @@ function Instance(args) { return (
{timer} - {navBtn} {readyBtn}
diff --git a/client/src/components/list.footer.jsx b/client/src/components/list.footer.jsx deleted file mode 100644 index 65109d72..00000000 --- a/client/src/components/list.footer.jsx +++ /dev/null @@ -1,48 +0,0 @@ -const { connect } = require('preact-redux'); -const preact = require('preact'); - -const actions = require('./../actions'); - -const addState = connect( - function receiveState(state) { - const { showNav } = state; - return { showNav }; - }, - function receiveDispatch(dispatch) { - function navToTeam() { - return dispatch(actions.setNav('team')); - } - - function setShowNav(v) { - return dispatch(actions.setShowNav(v)); - } - - return { - navToTeam, - setShowNav, - }; - } -); - -function ListFooter(args) { - return false; - - // const { - // showNav, - - // navToTeam, - // setShowNav, - // } = args; - - // return ( - //
- // - // - //
- // ); -} - -module.exports = addState(ListFooter); diff --git a/client/src/components/play.footer.jsx b/client/src/components/play.footer.jsx new file mode 100644 index 00000000..f8a8479a --- /dev/null +++ b/client/src/components/play.footer.jsx @@ -0,0 +1,139 @@ +const preact = require('preact'); +const { connect } = require('preact-redux'); + +const { errorToast, infoToast } = require('../utils'); + +const AccountBox = require('./account.box'); + +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) { + const { + instances, + invite, + + sendInstanceState, + sendInstanceQueue, + sendInstancePractice, + sendInstanceInvite, + } = args; + + const discordBtn = ( + + ); + + if (instances.length) { + return ( +
+
+ +
+ ); + } + + const inviteBtn = () => { + if (!invite) { + return ( + + ); + } + + 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.'); + } catch (err) { + console.error('link copy error', err); + errorToast('Invite link copy error.'); + } + + document.body.removeChild(textArea); + return true; + } + + return ( + + ); + }; + + return ( +
+
+ + {inviteBtn()} + +
+ ); +} + +module.exports = addState(JoinButtons); diff --git a/server/src/names.rs b/server/src/names.rs index e5ff7943..48d81c7c 100644 --- a/server/src/names.rs +++ b/server/src/names.rs @@ -1,7 +1,7 @@ use rand::prelude::*; use rand::{thread_rng}; -const FIRSTS: [&'static str; 50] = [ +const FIRSTS: [&'static str; 51] = [ "artificial", "ambient", "borean", @@ -17,6 +17,7 @@ const FIRSTS: [&'static str; 50] = [ "emotive", "emotionless", "elliptical", + "extrasolar", "fierce", "fossilised", "frozen", @@ -54,9 +55,10 @@ const FIRSTS: [&'static str; 50] = [ "weary", ]; -const LASTS: [&'static str; 55] = [ +const LASTS: [&'static str; 56] = [ "artifact", "assembly", + "alloy", "carbon", "console", "construct", @@ -68,7 +70,7 @@ const LASTS: [&'static str; 55] = [ "detector", "energy", "entropy", - "exomorph", + "exoplanet", "foilage", "forest", "form", From 9af3fd315563406ecd0c31976944db413418eea5 Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 24 Sep 2019 13:34:01 +1000 Subject: [PATCH 08/11] green power base, spec inconsistency --- server/src/construct.rs | 2 +- server/src/spec.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/construct.rs b/server/src/construct.rs index fae3f1e7..fdc62ed6 100644 --- a/server/src/construct.rs +++ b/server/src/construct.rs @@ -223,7 +223,7 @@ impl Construct { red_life: ConstructStat { base: 0, value: 0, max: 0, stat: Stat::RedLife }, blue_power: ConstructStat { base: 320, value: 320, max: 320, stat: Stat::BluePower }, blue_life: ConstructStat { base: 0, value: 0, max: 0, stat: Stat::BlueLife }, - green_power: ConstructStat { base: 320, value: 300, max: 300, stat: Stat::GreenPower }, + green_power: ConstructStat { base: 300, value: 300, max: 300, stat: Stat::GreenPower }, green_life: ConstructStat { base: 950, value: 950, max: 950, stat: Stat::GreenLife }, speed: ConstructStat { base: 100, value: 100, max: 100, stat: Stat::Speed }, // evasion: ConstructStat { base: 0, value: 0, max: 0, stat: Stat::Evasion }, diff --git a/server/src/spec.rs b/server/src/spec.rs index 53a7c27f..a809339d 100644 --- a/server/src/spec.rs +++ b/server/src/spec.rs @@ -317,18 +317,18 @@ impl Spec { Spec::PowerGBPlusPlus => SpecValues { base: 40, bonuses: vec![ - SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 25 }, - SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 25 }, - SpecBonus { req: Colours { red: 0, green: 10, blue: 10 }, bonus: 25 } + SpecBonus { req: Colours { red: 0, green: 2, blue: 2 }, bonus: 40 }, + SpecBonus { req: Colours { red: 0, green: 5, blue: 5 }, bonus: 40 }, + SpecBonus { req: Colours { red: 0, green: 10, blue: 10 }, bonus: 40 } ], }, Spec::PowerRBPlusPlus => SpecValues { base: 40, bonuses: vec![ - SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 25 }, - SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 25 }, - SpecBonus { req: Colours { red: 10, green: 0, blue: 10 }, bonus: 25 } + SpecBonus { req: Colours { red: 2, green: 0, blue: 2 }, bonus: 40 }, + SpecBonus { req: Colours { red: 5, green: 0, blue: 5 }, bonus: 40 }, + SpecBonus { req: Colours { red: 10, green: 0, blue: 10 }, bonus: 40 } ], }, From 0d3c4374badc8914a8d817c188d4e22a1306a261 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 24 Sep 2019 13:49:34 +1000 Subject: [PATCH 09/11] swiping pog --- ...stance.mobile.css => instance.mobile.less} | 34 +++---- client/index.js | 2 +- client/package.json | 1 + client/src/actions.jsx | 1 + client/src/components/instance.component.jsx | 90 ++++++++++++++----- client/src/components/instance.constructs.jsx | 20 ++++- client/src/components/instance.footer.jsx | 42 +-------- client/src/components/vbox.component.jsx | 7 +- client/src/reducers.jsx | 1 + 9 files changed, 108 insertions(+), 90 deletions(-) rename client/assets/styles/{instance.mobile.css => instance.mobile.less} (84%) diff --git a/client/assets/styles/instance.mobile.css b/client/assets/styles/instance.mobile.less similarity index 84% rename from client/assets/styles/instance.mobile.css rename to client/assets/styles/instance.mobile.less index acc33451..07c76286 100644 --- a/client/assets/styles/instance.mobile.css +++ b/client/assets/styles/instance.mobile.less @@ -1,3 +1,5 @@ +@import 'colours.less'; + @media (max-width: 800px) { .instance { font-size: 8pt; @@ -7,14 +9,14 @@ grid-template-areas: "vbox" "constructs"; + + .info { + display: none; + } } .instance .nav-btn { display: initial; } - /* Default view */ - .instance .equip { display: none; } - .instance .info { display: none; } - .instance .construct-list { display: none; } .vbox { grid-area: vbox; margin-bottom: 0; @@ -27,6 +29,9 @@ "inventory" "combiner"; + &:not(.visible) { + display: none; + } } .vbox-arrow { @@ -45,24 +50,13 @@ margin: 0; } - /* constructs toggled on */ - .instance.constructs-visible .vbox { - display: none; - } - - .instance.constructs-visible .equip { - display: initial; - grid-area: vbox; - margin: 0; - } - - .instance.constructs-visible .highlight { - display: initial; - } - - .instance.constructs-visible .construct-list { + .construct-list { display: grid; grid-auto-rows: 1fr; + + .instance-construct:not(.visible) { + display: none; + }; } .vbox-inventory { diff --git a/client/index.js b/client/index.js index ae5df689..8ad272c9 100644 --- a/client/index.js +++ b/client/index.js @@ -9,7 +9,7 @@ require('./assets/styles/vbox.less'); require('./assets/styles/game.less'); require('./assets/styles/player.less'); require('./assets/styles/styles.mobile.css'); -require('./assets/styles/instance.mobile.css'); +require('./assets/styles/instance.mobile.less'); // kick it off require('./src/app'); diff --git a/client/package.json b/client/package.json index 51074c78..c0350a08 100644 --- a/client/package.json +++ b/client/package.json @@ -19,6 +19,7 @@ "async": "^2.6.2", "borc": "^2.0.3", "docco": "^0.7.0", + "hammerjs": "^2.0.8", "izitoast": "^1.4.0", "keymaster": "^1.6.2", "linkstate": "^1.1.1", diff --git a/client/src/actions.jsx b/client/src/actions.jsx index ccfadcaa..282d2474 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -27,6 +27,7 @@ export const setItemInfo = value => ({ type: 'SET_ITEM_INFO', value }); export const setItemUnequip = value => ({ type: 'SET_ITEM_UNEQUIP', value }); export const setMtxActive = value => ({ type: 'SET_MTX_ACTIVE', value }); export const setNav = value => ({ type: 'SET_NAV', value }); +export const setNavInstance = value => ({ type: 'SET_NAV_INSTANCE', value }); export const setPing = value => ({ type: 'SET_PING', value }); export const setPlayer = value => ({ type: 'SET_PLAYER', value }); export const setReclaiming = value => ({ type: 'SET_RECLAIMING', value }); diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index 12f78532..864bf9e2 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -1,6 +1,9 @@ +const { Component } = require('preact'); const preact = require('preact'); const { connect } = require('preact-redux'); +const Hammer = require('hammerjs'); + const Vbox = require('./vbox.component'); const InfoContainer = require('./info.container'); const InstanceConstructsContainer = require('./instance.constructs'); @@ -11,8 +14,14 @@ const actions = require('../actions'); const addState = connect( function receiveState(state) { - const { instance, nav } = state; - return { instance, nav }; + const { instance, + nav, + navInstance, + } = state; + return { instance, + nav, + navInstance, + }; }, function receiveDispatch(dispatch) { @@ -20,6 +29,11 @@ const addState = connect( return dispatch(actions.setInfo(c)); } + function setNavInstance(c) { + return dispatch(actions.setNavInstance(c)); + } + + function clearItems() { dispatch(actions.setCombiner([])); dispatch(actions.setReclaiming(false)); @@ -33,38 +47,68 @@ const addState = connect( return { setInfo, clearItems, + setNavInstance, }; } ); -function Instance(args) { - const { - instance, - setInfo, - clearItems, +class Instance extends Component { + render(args) { + const { + instance, + setInfo, + clearItems, + } = args; - nav, - } = args; + if (!instance) return false; - if (!instance) return false; + if (instance.phase !== 'InProgress') { + return ; + } - if (instance.phase !== 'InProgress') { - return ; + function instanceClick(e) { + e.stopPropagation(); + clearItems(); + } + + return ( +
setInfo(null)} > + + + +
+ ); } - function instanceClick(e) { - e.stopPropagation(); - clearItems(); + componentDidMount() { + this.bindSwipes(); } - const instanceClasses = `instance ${nav === 'constructs' ? 'constructs-visible' : ''}`; - return ( -
setInfo(null)} > - - - -
- ); + bindSwipes() { + const instance = document.getElementById('instance'); + if (!instance) return setTimeout(this.bindSwipes, 50); + if (this.h) this.h.destroy(); + this.h = new Hammer(instance); + const display = ['vbox', 'c0', 'c1', 'c2']; + + this.h.on('swiperight', () => { + const { + navInstance, + setNavInstance, + } = this.props; + setNavInstance(navInstance === 0 ? 3 : navInstance - 1); + }); + + this.h.on('swipeleft', () => { + const { + navInstance, + setNavInstance, + } = this.props; + setNavInstance((navInstance + 1) % 4); + }); + + return true; + } } module.exports = addState(Instance); diff --git a/client/src/components/instance.constructs.jsx b/client/src/components/instance.constructs.jsx index 9afd9cc5..fce829f5 100644 --- a/client/src/components/instance.constructs.jsx +++ b/client/src/components/instance.constructs.jsx @@ -9,7 +9,16 @@ const actions = require('../actions'); const addState = connect( function receiveState(state) { - const { ws, instance, player, account, itemInfo, itemEquip, activeConstruct } = state; + const { + ws, + instance, + player, + account, + itemInfo, + itemEquip, + activeConstruct, + navInstance, + } = state; function sendVboxApply(constructId, i) { return ws.sendVboxApply(instance.id, constructId, i); @@ -26,6 +35,7 @@ const addState = connect( sendVboxApply, itemInfo, itemEquip, + navInstance, activeConstruct, sendUnequip, }; @@ -63,7 +73,6 @@ const addState = connect( function Construct(props) { const { - activeConstruct, itemEquip, construct, player, @@ -74,6 +83,7 @@ function Construct(props) { itemInfo, setInfo, sendUnequip, + mobileVisible, } = props; function onClick(e) { @@ -191,8 +201,10 @@ function Construct(props) { ; }); + const classes = `instance-construct ${mobileVisible ? 'visible' : ''}`; + return ( -
+

{construct.name}

hoverInfo(e, 'constructSkills')} > @@ -224,6 +236,7 @@ function InstanceConstructs(props) { setItemUnequip, setItemEquip, sendUnequip, + navInstance, } = props; if (!player) return false; @@ -242,6 +255,7 @@ function InstanceConstructs(props) { itemInfo, setVboxHighlight, sendUnequip, + mobileVisible: navInstance === i + 1, })); const classes = `construct-list`; diff --git a/client/src/components/instance.footer.jsx b/client/src/components/instance.footer.jsx index 4a01e943..82e01681 100644 --- a/client/src/components/instance.footer.jsx +++ b/client/src/components/instance.footer.jsx @@ -15,16 +15,11 @@ const addState = connect( }, function receiveDispatch(dispatch) { - function setInfo(c) { - return dispatch(actions.setInfo(c)); - } - function setNav(v) { return dispatch(actions.setNav(v)); } return { - setInfo, setNav, }; } @@ -34,29 +29,11 @@ function Instance(args) { const { instance, player, - nav, - showNav, - - setInfo, - setNav, sendInstanceReady, } = args; - if (!instance || !player) { - return ( -
- -
- ); - } - - function hoverInfo(e, info) { - e.stopPropagation(); - return setInfo(info); - } - - const rdyClasses = `${player.ready ? 'ready ready-btn' : 'ready-btn'}`; + const rdyClasses = `ready-btn ready`; const readyInfo = instance.phase === 'Lobby' ? 'lobbyReady' : 'ready'; @@ -64,27 +41,11 @@ function Instance(args) { const readyBtn = ( ); - function navClick() { - if (nav === 'vbox') return setNav('constructs'); - return setNav('vbox'); - } - - const navBtn = instance.phase === 'InProgress' - ? ( - - ) - : null; - const zero = Date.parse(instance.phase_start); const now = Date.now(); const end = Date.parse(instance.phase_end); @@ -112,7 +73,6 @@ function Instance(args) { return (
{timer} - {navBtn} {readyBtn}
); diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index e659ee72..53c03819 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -17,6 +17,7 @@ const addState = connect( vboxSelected, itemInfo, itemUnequip, + navInstance, } = state; function sendVboxDiscard() { @@ -51,7 +52,8 @@ const addState = connect( vboxSelected, itemInfo, itemUnequip, - sendItemUnequip + sendItemUnequip, + navInstance, }; }, @@ -90,6 +92,7 @@ const addState = connect( function Vbox(args) { const { combiner, + navInstance, // instance, itemInfo, player, @@ -348,7 +351,7 @@ function Vbox(args) { return setInfo(info); } - const classes = 'vbox'; + const classes = `vbox ${navInstance === 0 ? 'visible' : ''}`; return (
{vboxElement()} diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx index 349d6e91..588caa53 100644 --- a/client/src/reducers.jsx +++ b/client/src/reducers.jsx @@ -40,6 +40,7 @@ module.exports = { itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'), mtxActive: createReducer(null, 'SET_MTX_ACTIVE'), nav: createReducer(null, 'SET_NAV'), + navInstance: createReducer(0, 'SET_NAV_INSTANCE'), showNav: createReducer(null, 'SET_SHOW_NAV'), ping: createReducer(null, 'SET_PING'), player: createReducer(null, 'SET_PLAYER'), From 460a25c81ad4ba1f93b351dc9d22ed420a1c9f39 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 24 Sep 2019 14:32:37 +1000 Subject: [PATCH 10/11] scrolling fix --- acp/acp.js | 2 +- bin/client.sh | 12 ++++++------ client/assets/styles/styles.less | 2 +- client/assets/styles/styles.mobile.css | 8 ++++++-- client/src/components/instance.component.jsx | 6 +++++- client/src/components/welcome.jsx | 2 +- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/acp/acp.js b/acp/acp.js index 0f4b8299..03ee6846 100644 --- a/acp/acp.js +++ b/acp/acp.js @@ -12,7 +12,7 @@ require('./../client/assets/styles/instance.less'); require('./../client/assets/styles/vbox.less'); require('./../client/assets/styles/game.less'); require('./../client/assets/styles/styles.mobile.css'); -require('./../client/assets/styles/instance.mobile.css'); +require('./../client/assets/styles/instance.mobile.less'); // kick it off require('./src/acp'); diff --git a/bin/client.sh b/bin/client.sh index 922b77d3..2ae62d06 100755 --- a/bin/client.sh +++ b/bin/client.sh @@ -13,9 +13,9 @@ rm -rf dist npm i npm run build -echo "Building acp version $VERSION" -cd $MNML_PATH/acp -rm -rf dist -npm i -npm run build -mv dist/* $MNML_PATH/client/dist/ +# echo "Building acp version $VERSION" +# cd $MNML_PATH/acp +# rm -rf dist +# npm i +# npm run build +# mv dist/* $MNML_PATH/client/dist/ diff --git a/client/assets/styles/styles.less b/client/assets/styles/styles.less index 004ffef9..2a1d8451 100644 --- a/client/assets/styles/styles.less +++ b/client/assets/styles/styles.less @@ -23,7 +23,7 @@ html body { /* stops inspector going skitz*/ overflow-x: hidden; - overflow-y: hidden; + // overflow-y: hidden; } @media (min-width: 1921px) { diff --git a/client/assets/styles/styles.mobile.css b/client/assets/styles/styles.mobile.css index 1eb5963d..ec43c8d2 100644 --- a/client/assets/styles/styles.mobile.css +++ b/client/assets/styles/styles.mobile.css @@ -1,14 +1,16 @@ @media (max-width: 800px) { - #mnml { font-size: 12pt; padding: 0; grid-template-columns: 1fr; grid-template-rows: 1fr min-content; - /*overflow-y: scroll;*/ grid-template-areas: "main" "footer"; + + height: 100vh; + max-height: initial; + min-height: initial; } #mnml button { @@ -52,6 +54,8 @@ */ main { overflow-x: hidden; + overflow-y: initial; + max-height: 100vh; padding: 0 0.5em; } diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index 864bf9e2..0da7dced 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -71,8 +71,12 @@ class Instance extends Component { clearItems(); } + function onTouchMove(e) { + e.preventDefault(); + } + return ( -
setInfo(null)} > +
setInfo(null)} onTouchMove={onTouchMove}> diff --git a/client/src/components/welcome.jsx b/client/src/components/welcome.jsx index 70bde16d..6146b7a0 100644 --- a/client/src/components/welcome.jsx +++ b/client/src/components/welcome.jsx @@ -19,7 +19,7 @@ function Welcome() { }; return ( -
+