From 3f18f3628a832bd845145e5a83a3958545acb2e4 Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 13 Nov 2019 21:56:12 +1100 Subject: [PATCH 01/45] worklog --- WORKLOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WORKLOG.md b/WORKLOG.md index 52e0b9c8..2f3463b2 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -6,6 +6,9 @@ * can't reset password without knowing password =\ * ws gzip encoding +* skip faceoff for practice +* concede round + * Graphics * Img * Skill Icons From 44ae33d8ea2dd474abf7af3c95633bdb14394224 Mon Sep 17 00:00:00 2001 From: Mashy Date: Wed, 13 Nov 2019 21:15:46 +1000 Subject: [PATCH 02/45] log --- WORKLOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WORKLOG.md b/WORKLOG.md index 2f3463b2..767c9b4e 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -9,6 +9,8 @@ * skip faceoff for practice * concede round +* look into ruin event bug + * Graphics * Img * Skill Icons From 496c57ea776d8fd2f903cd6a813c0cef39268561 Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 21:21:49 +1000 Subject: [PATCH 03/45] hotfix tutorial bits stage bug --- client/src/tutorial.utils.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/tutorial.utils.jsx b/client/src/tutorial.utils.jsx index b3569b26..e5846b39 100644 --- a/client/src/tutorial.utils.jsx +++ b/client/src/tutorial.utils.jsx @@ -21,7 +21,7 @@ function tutorialVbox(player, store, tutorial) { let stage = tutorial; const { vbox } = player; if (stage === 1) { - if (vbox.bits < 17) { + if (vbox.bits < 29) { stage += 1; } else { vbox.free[0] = vbox.free[0].slice(0, 2); @@ -54,7 +54,7 @@ function tutorialVbox(player, store, tutorial) { } if (stage === 4) { - if (!vbox.free[2][0] || vbox.bits < 12) { + if (!vbox.free[2][0] || vbox.bits < 24) { stage += 1; } else { vbox.free[0] = []; @@ -86,7 +86,7 @@ function tutorialVbox(player, store, tutorial) { } if (stage === 7) { - if (vbox.bits < 13) { + if (vbox.bits < 25) { stage += 1; } else { vbox.free[0] = []; From 94b6f6b18f247239aa1eacd9b97b7a348961821b Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 21:23:52 +1000 Subject: [PATCH 04/45] 1.8.4 --- VERSION | 2 +- acp/package.json | 2 +- client/package.json | 2 +- ops/package.json | 2 +- server/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index fe4e75fb..7b378be3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.3 \ No newline at end of file +1.8.4 \ No newline at end of file diff --git a/acp/package.json b/acp/package.json index 18b68a3f..44afd85c 100644 --- a/acp/package.json +++ b/acp/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.8.3", + "version": "1.8.4", "description": "", "main": "index.js", "scripts": { diff --git a/client/package.json b/client/package.json index 96747156..f8df9997 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.8.3", + "version": "1.8.4", "description": "", "main": "index.js", "scripts": { diff --git a/ops/package.json b/ops/package.json index 654b3f8e..89b0dd0b 100644 --- a/ops/package.json +++ b/ops/package.json @@ -1,6 +1,6 @@ { "name": "mnml-ops", - "version": "1.8.3", + "version": "1.8.4", "description": "", "main": "index.js", "scripts": { diff --git a/server/Cargo.toml b/server/Cargo.toml index 46acb90a..ca7845d4 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml" -version = "1.8.3" +version = "1.8.4" authors = ["ntr "] [dependencies] From 3aafbefa7e08c87e96d4cbf506a8554e035c1443 Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 21:24:32 +1000 Subject: [PATCH 05/45] changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63a21137..4c06d28a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## [1.8.3] - 2019-11-10 +## [1.8.3] - 2019-11-14 +### Fixed +- Bug with tutorial introduced in last patch + +## [1.8.3] - 2019-11-13 ### Added - Preview combos by hovering over recipes - Condensed recipe display From 2f9c608e6bee921446b982dd8cf1bc8569c0ed91 Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 21:26:02 +1000 Subject: [PATCH 06/45] changelog --- client/changelog.html | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/client/changelog.html b/client/changelog.html index 68719026..9dfc59eb 100644 --- a/client/changelog.html +++ b/client/changelog.html @@ -731,7 +731,14 @@ pre { } } CHANGELOG

-[1.8.3] - 2019-11-10

+[1.8.3] - 2019-11-14 +

+Fixed

+
    +
  • Bug with tutorial introduced in last patch
  • +
+

+[1.8.3] - 2019-11-13

Added

    @@ -739,7 +746,7 @@ pre {
  • Condensed recipe display

-Fixed

+Fixed
  • Construct display on info / demo page
  • Case where a skill could send multiple ko events to target
  • @@ -754,7 +761,7 @@ pre {
  • Purify
    • Now removes all effects on target
    • -
    • Applies "Purified" increasing healing taken
    • +
    • Applies "Pure" increasing healing taken
  • Purge @@ -766,14 +773,14 @@ pre {

    [1.8.2] - 2019-11-10

    -Fixed

    +Fixed
    • Duplicate button issue in reshape tab

    [1.8.1] - 2019-11-09

    -Fixed

    +Fixed
    • An issue where skills would not be put on cooldown after being used.
    @@ -1070,7 +1077,7 @@ pre {

    [1.6.5] - 2019-10-25

    -Fixed

    +Fixed
    • Stripe being blocked no longer causes unrecoverable error
    • Automatic ready up is now throttled after abandons
    • @@ -1102,7 +1109,7 @@ pre {

    -Fixed

    +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.
    • @@ -1113,7 +1120,7 @@ pre {

      [1.6.2] - 2019-10-20

      -Fixed

      +Fixed
      • Combiner bug where it would preview items for different combinations
      • Skill descriptions are cleared when animations start
      • @@ -1152,7 +1159,7 @@ pre {

      -Fixed

      +Fixed
      • Matchmaking bug where server matches you with yourself
      From 8fab03650ae12043beb07092cec5e32be1135b09 Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 23:11:34 +1000 Subject: [PATCH 07/45] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c06d28a..60581b5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [1.8.3] - 2019-11-14 +## [1.8.4] - 2019-11-14 ### Fixed - Bug with tutorial introduced in last patch From 2b3b002a0ebda0052ec8ea55a1e743197f9e94c1 Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 23:28:49 +1000 Subject: [PATCH 08/45] 1.8.4 html --- client/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/changelog.html b/client/changelog.html index 9dfc59eb..bc1b70c4 100644 --- a/client/changelog.html +++ b/client/changelog.html @@ -731,7 +731,7 @@ pre { } } CHANGELOG

      -[1.8.3] - 2019-11-14

      +[1.8.4] - 2019-11-14

      Fixed

        From 9acb2229a8943510c03fe0fb4304c1947137a31e Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 14 Nov 2019 23:31:09 +1000 Subject: [PATCH 09/45] line endings --- bin/client.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 bin/client.sh diff --git a/bin/client.sh b/bin/client.sh old mode 100755 new mode 100644 From fbae8f71eba55faeae1e9e2c1fae7e3fa788b77e Mon Sep 17 00:00:00 2001 From: Mashy Date: Fri, 15 Nov 2019 11:22:05 +1000 Subject: [PATCH 10/45] only send ko event if theres damage --- server/src/skill.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/src/skill.rs b/server/src/skill.rs index d490bbec..d94cdc96 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -348,15 +348,16 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) -> }; } } + + if target.is_ko() && event_target.green == 0 { + // Make sure target ko is from this event + target.effects.clear(); + resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); + } }, _ => (), }; - if target.is_ko() && event_target.green == 0 { - // Make sure target ko is from this event - target.effects.clear(); - resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); - } game.update_construct(&mut source); game.update_construct(&mut target); From f1072ec7c80cbd4fa77ef68323460159096dc8be Mon Sep 17 00:00:00 2001 From: Mashy Date: Sat, 16 Nov 2019 16:55:48 +1000 Subject: [PATCH 11/45] changelog --- CHANGELOG.md | 4 ++++ client/changelog.html | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60581b5f..c2c3cda7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.8.5] - 2019-11-16 +### Fixed +- Multiple ko event bug + ## [1.8.4] - 2019-11-14 ### Fixed - Bug with tutorial introduced in last patch diff --git a/client/changelog.html b/client/changelog.html index bc1b70c4..80ff3f64 100644 --- a/client/changelog.html +++ b/client/changelog.html @@ -731,10 +731,17 @@ pre { } } CHANGELOG

        -[1.8.4] - 2019-11-14

        +[1.8.5] - 2019-11-16

        Fixed

          +
        • Multiple ko event bug
        • +
        +

        +[1.8.4] - 2019-11-14

        +

        +Fixed

        +
        • Bug with tutorial introduced in last patch

        @@ -746,7 +753,7 @@ pre {
      • Condensed recipe display

      -Fixed

      +Fixed
      • Construct display on info / demo page
      • Case where a skill could send multiple ko events to target
      • @@ -773,14 +780,14 @@ pre {

        [1.8.2] - 2019-11-10

        -Fixed

        +Fixed
        • Duplicate button issue in reshape tab

        [1.8.1] - 2019-11-09

        -Fixed

        +Fixed
        • An issue where skills would not be put on cooldown after being used.
        @@ -1077,7 +1084,7 @@ pre {

        [1.6.5] - 2019-10-25

        -Fixed

        +Fixed
        • Stripe being blocked no longer causes unrecoverable error
        • Automatic ready up is now throttled after abandons
        • @@ -1109,7 +1116,7 @@ pre {

        -Fixed

        +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.
        • @@ -1120,7 +1127,7 @@ pre {

          [1.6.2] - 2019-10-20

          -Fixed

          +Fixed
          • Combiner bug where it would preview items for different combinations
          • Skill descriptions are cleared when animations start
          • @@ -1159,7 +1166,7 @@ pre {

          -Fixed

          +Fixed
          • Matchmaking bug where server matches you with yourself
          From 7ddfa2dcd20bf929a6fbb1f09c4f40c588757c98 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sat, 16 Nov 2019 16:56:44 +1000 Subject: [PATCH 12/45] 1.8.5 --- VERSION | 2 +- acp/package.json | 2 +- client/package.json | 2 +- ops/package.json | 2 +- server/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 7b378be3..ff2fd4fb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.4 \ No newline at end of file +1.8.5 \ No newline at end of file diff --git a/acp/package.json b/acp/package.json index 44afd85c..3ccf45a7 100644 --- a/acp/package.json +++ b/acp/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.8.4", + "version": "1.8.5", "description": "", "main": "index.js", "scripts": { diff --git a/client/package.json b/client/package.json index f8df9997..7a3dbf28 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "mnml-client", - "version": "1.8.4", + "version": "1.8.5", "description": "", "main": "index.js", "scripts": { diff --git a/ops/package.json b/ops/package.json index 89b0dd0b..786f8024 100644 --- a/ops/package.json +++ b/ops/package.json @@ -1,6 +1,6 @@ { "name": "mnml-ops", - "version": "1.8.4", + "version": "1.8.5", "description": "", "main": "index.js", "scripts": { diff --git a/server/Cargo.toml b/server/Cargo.toml index ca7845d4..8152eff9 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mnml" -version = "1.8.4" +version = "1.8.5" authors = ["ntr "] [dependencies] From c799093a94910c4b6f1e33990bf9806a961b1ef2 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sat, 16 Nov 2019 17:06:45 +1000 Subject: [PATCH 13/45] +x client --- bin/client.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/client.sh diff --git a/bin/client.sh b/bin/client.sh old mode 100644 new mode 100755 From 21f66b105efc24fe5108808d02d0b69294f74129 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sun, 17 Nov 2019 21:52:29 +1000 Subject: [PATCH 14/45] worklog --- WORKLOG.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/WORKLOG.md b/WORKLOG.md index 767c9b4e..42df418e 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -16,13 +16,23 @@ * Skill Icons * Buttons / General UI Theming * Front Page + * Power / Speed / Life Icons - "Make use of piggybacking" + - Power (e.g. lightning bolt) + - Speed (e.g. boots) + - Life (e.g. heart) + + * represent construct colours during game phase (coloured border?) ## SOON -* Graphical status effects instead of text -* Improve colour contrast / buttons - * supporter gold name in instance (anyone whos put any money into game) +* buy from preview if you have the required bases in vbox / inventory + - a "buy" becomes available under the current info / preview section + - clicking the buy automatically purchases / combine items + - could also be used to upgrade already equipped skills / specs + - e.g. an equipped white power spec could be upgraded by clicking under preview + - if this was added we could reduce inventory size to 3 and rearrange vbox (see mockup img) + * change cooldowns to delay & recharge - delay is cooldown before skill can first be used - recharge is cooldown after using skill @@ -38,6 +48,8 @@ ## LATER +* Graphical status effects instead of text + * theme toasts * rework vecs into sets * remove names so games/instances are copy @@ -53,6 +65,11 @@ - Strike + SpeedRR -> StrikeSpeed (strike has Y% more speed) - Strike + LifeRR -> StrikeLife (Strike recharges X% of damage as red life) +* Energy generators / spenders + - Current skills generate team wide red / blue / green energy + - New special skill base consumes team energy to do "special" powerful moves + - Working as cooldowns in reverse by building up to the skill rather than waiting + * constants * (maybe) return of the combat log (last few events with condensed descriptions) - click in to scroll From 424c78b30d0f0511a7c84b32f50027d524f8b504 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sun, 17 Nov 2019 21:53:59 +1000 Subject: [PATCH 15/45] remove focus highlighting --- client/assets/styles/skeleton.css | 13 ------------- client/assets/styles/styles.less | 4 ++-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/client/assets/styles/skeleton.css b/client/assets/styles/skeleton.css index 8197aac0..13bb3549 100644 --- a/client/assets/styles/skeleton.css +++ b/client/assets/styles/skeleton.css @@ -188,19 +188,6 @@ input[type="button"] { border: 1px solid #bbb; cursor: pointer; box-sizing: border-box; } -.button:hover, -button:hover, -input[type="submit"]:hover, -input[type="reset"]:hover, -input[type="button"]:hover, -.button:focus, -button:focus, -input[type="submit"]:focus, -input[type="reset"]:focus, -input[type="button"]:focus { - color: #333; - border-color: #888; - outline: 0; } .button.button-primary, button.button-primary, input[type="submit"].button-primary, diff --git a/client/assets/styles/styles.less b/client/assets/styles/styles.less index 340947c3..3a9edf37 100644 --- a/client/assets/styles/styles.less +++ b/client/assets/styles/styles.less @@ -147,8 +147,8 @@ button, input { &:focus { /*colour necesary to bash skellington*/ - color: @gray-focus; - border-color: @gray-focus; + + outline: 0; } } From f66be37f8a1bd11ce177cb2e791c88aa06e56196 Mon Sep 17 00:00:00 2001 From: Mashy Date: Sun, 17 Nov 2019 22:00:08 +1000 Subject: [PATCH 16/45] unselect vbox item --- client/src/components/vbox.component.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index d9589c2c..01ce93c9 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -192,6 +192,7 @@ class Vbox extends preact.Component { setItemEquip(null); setCombiner([]); setInfo(vbox.free[group][index]); + if (vboxSelected[0] === group && vboxSelected[1] === index) return clearVboxSelected(); return setVboxSelected([group, index]); } From 5fdabc0f21b79cc952ecddf829fdef59c1523a36 Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 18 Nov 2019 23:00:58 +1000 Subject: [PATCH 17/45] don't compile logger on windows --- server/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/lib.rs b/server/src/lib.rs index 0885919a..776c653a 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -62,6 +62,7 @@ use std::path::{Path}; use fern::colors::{Color, ColoredLevelConfig}; use crossbeam_channel::{unbounded}; +#[cfg(unix)] pub fn setup_logger() -> Result<(), fern::InitError> { let formatter = syslog::Formatter3164 { facility: syslog::Facility::LOG_USER, @@ -109,6 +110,7 @@ pub fn setup_logger() -> Result<(), fern::InitError> { } pub fn start() { + #[cfg(unix)] setup_logger().unwrap(); dotenv::from_path(Path::new("/etc/mnml/gs.conf")).ok(); From 2c14cfc494ac0c43a4ac56363d7544ad050752eb Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 18 Nov 2019 23:58:48 +1000 Subject: [PATCH 18/45] lock info when vbox / inv items selected --- client/src/components/instance.constructs.jsx | 4 ++-- client/src/components/vbox.component.jsx | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/components/instance.constructs.jsx b/client/src/components/instance.constructs.jsx index 577fe84c..16870b9c 100644 --- a/client/src/components/instance.constructs.jsx +++ b/client/src/components/instance.constructs.jsx @@ -120,10 +120,10 @@ function Construct(props) { setItemUnequip([]); return true; } - function hoverInfo(e, info) { - if (!info) return false; e.stopPropagation(); + if (!info) return false; + if (vboxSelected[0] || itemEquip > -1) return false; return setInfo(info); } diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index 01ce93c9..a13c1c4e 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -436,10 +436,16 @@ class Vbox extends preact.Component { // function hoverInfo(e, newInfo) { e.stopPropagation(); + + if (vboxSelected[0]) return true; + if (combiner.length !== 0) { + const base = combiner.find(c => !['Red', 'Blue', 'Green'].includes(vbox.bound[c])); + if (base || base === 0) return true; + } return setInfo(newInfo); } - const classes = `vbox`; + const classes = 'vbox'; return (
          {vboxElement()} From f850a8806b783c314fba8b53b9020aec0e1bb830 Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 19 Nov 2019 10:30:00 +1000 Subject: [PATCH 19/45] mouseover --- client/src/components/construct.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/construct.jsx b/client/src/components/construct.jsx index 112126d8..c39b219c 100644 --- a/client/src/components/construct.jsx +++ b/client/src/components/construct.jsx @@ -35,7 +35,7 @@ class ConstructAvatar extends Component { class="avatar" id={construct.id} onMouseDown={this.onClick.bind(this)} - onMouseOver={mouseOver ? mouseOver : null} + onMouseOver={mouseOver} style={{ 'background-image': `url(/imgs/${construct.img}.svg)` }}>
          @@ -86,11 +86,12 @@ class ConstructAvatar extends Component { shouldComponentUpdate(newProps) { - const { animSource, animTarget, animText, construct } = newProps; + const { animSource, animTarget, animText, construct, mouseOver } = newProps; if (animSource !== this.props.animSource) return true; if (animTarget !== this.props.animTarget) return true; if (animText !== this.props.animText) return true; if (construct !== this.props.construct) return true; + if (mouseOver !== this.props.mouseOver) return true; return false; } } From 0d08536837102a1d2eff940a19eab1e04ccd7d56 Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 19 Nov 2019 10:35:45 +1000 Subject: [PATCH 20/45] add vbox indicies as a combine param --- client/src/socket.jsx | 4 ++-- server/src/instance.rs | 4 ++-- server/src/player.rs | 6 +++--- server/src/rpc.rs | 6 +++--- server/src/vbox.rs | 21 ++++++++------------- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/client/src/socket.jsx b/client/src/socket.jsx index 959bfc30..fe9db53b 100644 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -107,8 +107,8 @@ function createSocket(events) { events.clearInstance(); } - function sendVboxCombine(instanceId, indices) { - send(['VboxCombine', { instance_id: instanceId, indices }]); + function sendVboxCombine(instanceId, invIndicies) { + send(['VboxCombine', { instance_id: instanceId, inv_indices: invIndicies, vbox_indices: [] }]); events.clearInstance(); } diff --git a/server/src/instance.rs b/server/src/instance.rs index 16f42e8a..c5ec9c04 100644 --- a/server/src/instance.rs +++ b/server/src/instance.rs @@ -480,10 +480,10 @@ impl Instance { Ok(self) } - pub fn vbox_combine(mut self, account: Uuid, indices: Vec) -> Result { + pub fn vbox_combine(mut self, account: Uuid, inv_indices: Vec, vbox_indices: Vec>) -> Result { self.vbox_action_allowed(account)?; self.account_player(account)? - .vbox_combine(indices)?; + .vbox_combine(inv_indices, vbox_indices)?; Ok(self) } diff --git a/server/src/player.rs b/server/src/player.rs index ffa7c379..6a0a5abd 100644 --- a/server/src/player.rs +++ b/server/src/player.rs @@ -229,7 +229,7 @@ impl Player { }; // first 2 colours can be whatever - self.vbox_combine(vec![0, 1, combo_i]).ok(); + self.vbox_combine(vec![0, 1, combo_i], vec![]).ok(); let item_i = self.vbox.bound.len() - 1; self.vbox_apply(item_i, target_construct_id).ok(); } @@ -257,8 +257,8 @@ impl Player { Ok(self) } - pub fn vbox_combine(&mut self, indices: Vec) -> Result<&mut Player, Error> { - self.vbox.combine(indices)?; + pub fn vbox_combine(&mut self, inv_indices: Vec, vbox_indices: Vec>) -> Result<&mut Player, Error> { + self.vbox.combine(inv_indices, vbox_indices)?; Ok(self) } diff --git a/server/src/rpc.rs b/server/src/rpc.rs index 0e5fa28d..57190a44 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -115,7 +115,7 @@ pub enum RpcRequest { VboxAccept { instance_id: Uuid, group: usize, index: usize }, VboxAcceptEquip { instance_id: Uuid, group: usize, index: usize, construct_id: Uuid }, VboxDiscard { instance_id: Uuid }, - VboxCombine { instance_id: Uuid, indices: Vec }, + VboxCombine { instance_id: Uuid, inv_indices: Vec, vbox_indices: Vec> }, VboxApply { instance_id: Uuid, construct_id: Uuid, index: usize }, VboxUnequip { instance_id: Uuid, construct_id: Uuid, target: Item }, VboxUnequipApply { instance_id: Uuid, construct_id: Uuid, target: Item, target_construct_id: Uuid }, @@ -249,8 +249,8 @@ impl Connection { RpcRequest::VboxApply { instance_id, construct_id, index } => Ok(RpcMessage::InstanceState(vbox_apply(&mut tx, account, instance_id, construct_id, index)?)), - RpcRequest::VboxCombine { instance_id, indices } => - Ok(RpcMessage::InstanceState(vbox_combine(&mut tx, account, instance_id, indices)?)), + RpcRequest::VboxCombine { instance_id, inv_indices, vbox_indices } => + Ok(RpcMessage::InstanceState(vbox_combine(&mut tx, account, instance_id, inv_indices, vbox_indices)?)), RpcRequest::VboxDiscard { instance_id } => Ok(RpcMessage::InstanceState(vbox_discard(&mut tx, account, instance_id)?)), diff --git a/server/src/vbox.rs b/server/src/vbox.rs index 6b84a187..df785bae 100644 --- a/server/src/vbox.rs +++ b/server/src/vbox.rs @@ -142,19 +142,14 @@ impl Vbox { Ok(self) } - pub fn combine(&mut self, mut indices: Vec) -> Result<&mut Vbox, Error> { - if indices.len() != 3 { - return Err(err_msg("exactly 3 indices required")); - } - - if !indices.iter().all(|i| self.bound.get(*i).is_some()) { + pub fn combine(&mut self, mut inv_indices: Vec, mut vbox_indicies: Vec>) -> Result<&mut Vbox, Error> { + if !inv_indices.iter().all(|i| self.bound.get(*i).is_some()) { return Err(err_msg("item missing index")); } - // have to sort the indices and keep track of the iteration // because when removing the elements the array shifts - indices.sort_unstable(); - let mut input = indices + inv_indices.sort_unstable(); + let mut input = inv_indices .iter() .enumerate() .map(|(i, index)| { @@ -187,9 +182,9 @@ pub fn vbox_accept(tx: &mut Transaction, account: &Account, instance_id: Uuid, g return instance_update(tx, instance); } -pub fn vbox_combine(tx: &mut Transaction, account: &Account, instance_id: Uuid, indices: Vec) -> Result { +pub fn vbox_combine(tx: &mut Transaction, account: &Account, instance_id: Uuid, inv_indices: Vec, vbox_indices: Vec>) -> Result { let instance = instance_get(tx, instance_id)? - .vbox_combine(account.id, indices)?; + .vbox_combine(account.id, inv_indices, vbox_indices)?; return instance_update(tx, instance); } @@ -219,7 +214,7 @@ mod tests { fn combine_test() { let mut vbox = Vbox::new(); vbox.bound = vec![Item::Attack, Item::Green, Item::Green]; - vbox.combine(vec![1,2,0]).unwrap(); + vbox.combine(vec![1,2,0], vec![]).unwrap(); assert_eq!(vbox.bound[0], Item::Heal); } @@ -240,7 +235,7 @@ mod tests { let mut vbox = Vbox::new(); vbox.bound = vec![Item::Strike]; vbox.reclaim(0).unwrap(); - assert_eq!(vbox.bits, 20); + assert_eq!(vbox.bits, 32); } #[test] From 33152e54d5660f8bb18ab4f31f5768e9d20f66a8 Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 19 Nov 2019 11:35:30 +1000 Subject: [PATCH 21/45] select vbox multiple wip --- client/src/components/vbox.component.jsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index a13c1c4e..f80270a6 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -172,14 +172,13 @@ class Vbox extends preact.Component { if (!vboxSelecting) return false; document.activeElement.blur(); clearVboxSelected(); - sendVboxAccept(vboxSelected[0], vboxSelected[1]); + sendVboxAccept(vboxSelected[0][0], vboxSelected[0][1]); return true; } function availableBtn(v, group, index) { if (!v) return ; - const selected = vboxSelected[0] === group && vboxSelected[1] === index; - + const selected = vboxSelected.length && vboxSelected.some(vs => vs[0] === group && vs[1] === index); // state not yet set in double click handler function onDblClick(e) { clearVboxSelected(); @@ -190,10 +189,11 @@ class Vbox extends preact.Component { function onClick(e) { e.stopPropagation(); setItemEquip(null); - setCombiner([]); setInfo(vbox.free[group][index]); - if (vboxSelected[0] === group && vboxSelected[1] === index) return clearVboxSelected(); - return setVboxSelected([group, index]); + if (vboxSelected.length && vboxSelected.some(vs => vs[0] === group && vs[1] === index)) { + return setVboxSelected(vboxSelected.filter(vs => !(vs[0] === group && vs[1] === index))); + } + return setVboxSelected([...vboxSelected, [group, index]]); } const combinerItems = combiner.map(j => vbox.bound[j]); @@ -217,10 +217,7 @@ class Vbox extends preact.Component { const disabled = vbox.bits <= group; return (