From 3ad679cb021161afa6e52a83a5622321d9532cca Mon Sep 17 00:00:00 2001 From: Mashy Date: Fri, 20 Sep 2019 12:22:48 +1000 Subject: [PATCH] vbox show costs, penalty for combo sale --- WORKLOG.md | 2 +- client/src/components/info.component.jsx | 9 ++++----- server/src/item.rs | 18 ++++++++++++++++-- server/src/rpc.rs | 2 +- server/src/vbox.rs | 2 +- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/WORKLOG.md b/WORKLOG.md index 3fd7fa5d..4debb7b2 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -27,7 +27,7 @@ * fuck magic * empower on ko -var / skill info rpc -> sell cost / cooldown +var / skill info rpc -> cooldown * rework vecs into sets * remove names so games/instances are copy diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index b088f711..d0e85c25 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -52,7 +52,7 @@ function InfoComponent(args) { const speed =
Speed {shapes.SpeedStat()} multiplier {calcSpeed}%
; return (
-

{fullInfo.item}

+

{fullInfo.item} - {fullInfo.cost}b

SKILL

{itemSourceDescription}
{infoDescription}
@@ -133,7 +133,6 @@ function InfoComponent(args) { } return false; }); - console.log(info); const bonusObj = info.includes('Life') ?
+ {bonus.bonus}
:
+ {bonus.bonus}%
; @@ -157,7 +156,7 @@ function InfoComponent(args) { return (
-

{info}

+

{info} - {fullInfo.cost}b

SPEC

{itemSourceDescription}
{infoDescription}
@@ -167,10 +166,10 @@ function InfoComponent(args) {
); } - + const cost = fullInfo.cost ? `- ${fullInfo.cost}b` : false; return (
-

{fullInfo.item}

+

{fullInfo.item} {cost}

{fullInfo.description}
); diff --git a/server/src/item.rs b/server/src/item.rs index 42d564b5..80a8f6f2 100644 --- a/server/src/item.rs +++ b/server/src/item.rs @@ -320,7 +320,19 @@ impl Item { let combos = get_combos(); let combo = combos.iter().find(|c| c.item == *self) .unwrap_or_else(|| panic!("unable to find components for {:?}", self)); - return combo.components.iter().fold(0, |acc, c| acc + c.cost()); + return combo.components.iter().fold(0, |acc, c| { + match c { + Item::Attack | + Item::Block | + Item::Buff | + Item::Debuff | + Item::Stun => acc, + Item::Power | + Item::Life | + Item::Speed => acc + 1, + _ => acc + c.cost(), + } + }); }, } } @@ -960,7 +972,7 @@ impl Item { Item::BreakPlus => vec![Item::Break, Item::Break, Item::Break], Item::BreakPlusPlus => vec![Item::BreakPlus, Item::BreakPlus, Item::BreakPlus], Item::LinkPlus => vec![Item::Link, Item::Link, Item::Link], - Item::LinkPlusPlus => vec![Item::LinkPlusPlus, Item::LinkPlusPlus, Item::LinkPlusPlus], + Item::LinkPlusPlus => vec![Item::LinkPlus, Item::LinkPlus, Item::LinkPlus], Item::BanishPlus => vec![Item::Banish, Item::Banish, Item::Banish], Item::BanishPlusPlus => vec![Item::BanishPlus, Item::BanishPlus, Item::BanishPlus], @@ -1425,6 +1437,7 @@ pub fn get_combos() -> Vec { #[derive(Debug,Clone,Serialize,Deserialize)] pub struct ItemInfo { pub item: Item, + pub cost: usize, pub spec: bool, pub skill: bool, pub values: Option, @@ -1455,6 +1468,7 @@ pub fn item_info() -> ItemInfoCtr { .into_iter() .map(|v| ItemInfo { item: v, + cost: v.cost(), spec: v.into_spec().is_some(), skill: v.into_skill().is_some(), description: v.into_description(), diff --git a/server/src/rpc.rs b/server/src/rpc.rs index be3071e8..d006a316 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -14,7 +14,7 @@ use cookie::Cookie; use stripe::{Client as StripeClient, Subscription}; use crossbeam_channel::{unbounded, Sender as CbSender}; -use ws::{Builder, listen, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender}; +use ws::{Builder, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender}; use account::{Account}; use account; diff --git a/server/src/vbox.rs b/server/src/vbox.rs index 7088d0e9..c8df2087 100644 --- a/server/src/vbox.rs +++ b/server/src/vbox.rs @@ -240,7 +240,7 @@ mod tests { let mut vbox = Vbox::new(); vbox.bound = vec![Item::Strike]; vbox.reclaim(0).unwrap(); - assert_eq!(vbox.bits, 22); + assert_eq!(vbox.bits, 20); } #[test]