Merge branch 'release/1.2.0'
This commit is contained in:
commit
9c395bf825
10
WORKLOG.md
10
WORKLOG.md
@ -4,7 +4,6 @@
|
|||||||
* ACP
|
* ACP
|
||||||
* essential
|
* essential
|
||||||
* serde serialize privatise
|
* serde serialize privatise
|
||||||
* DO postgres
|
|
||||||
* mobile styles
|
* mobile styles
|
||||||
* can't reset password without knowing password =\
|
* can't reset password without knowing password =\
|
||||||
|
|
||||||
@ -13,10 +12,8 @@
|
|||||||
* background colour changes depending on time of day
|
* background colour changes depending on time of day
|
||||||
|
|
||||||
* bug fixes
|
* bug fixes
|
||||||
* pvp 1st player ready up doesn't get put in game
|
|
||||||
* pvp 1st round doesn't resolve until warden timer completes
|
* pvp 1st round doesn't resolve until warden timer completes
|
||||||
|
|
||||||
|
|
||||||
* bot game grind
|
* bot game grind
|
||||||
* stress test
|
* stress test
|
||||||
|
|
||||||
@ -65,12 +62,6 @@ mobile info page
|
|||||||
reconnect based on time delta
|
reconnect based on time delta
|
||||||
consolidate game and instance
|
consolidate game and instance
|
||||||
|
|
||||||
ah man
|
|
||||||
the ready screen should totally be
|
|
||||||
your constructs facing off against the other guy
|
|
||||||
the chatwheel
|
|
||||||
and a ready button
|
|
||||||
|
|
||||||
*SERVER*
|
*SERVER*
|
||||||
* vbox drops chances
|
* vbox drops chances
|
||||||
* 50% spec, 25% colour etc
|
* 50% spec, 25% colour etc
|
||||||
@ -78,7 +69,6 @@ and a ready button
|
|||||||
* mnml tv
|
* mnml tv
|
||||||
|
|
||||||
## LATER
|
## LATER
|
||||||
* chat
|
|
||||||
* elo + leaderboards
|
* elo + leaderboards
|
||||||
* constants
|
* constants
|
||||||
* change to ownership pattern
|
* change to ownership pattern
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mnml-client",
|
"name": "mnml-client",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -24,6 +24,7 @@ ssh -q "$TARGET" ls -lah "$SERVER_BIN_DIR"
|
|||||||
echo "syncing client $VERSION"
|
echo "syncing client $VERSION"
|
||||||
rsync -a --delete --delete-excluded "$MNML_PATH/client/dist/" "$TARGET:$CLIENT_DIST_DIR/$VERSION/"
|
rsync -a --delete --delete-excluded "$MNML_PATH/client/dist/" "$TARGET:$CLIENT_DIST_DIR/$VERSION/"
|
||||||
ssh -q "$TARGET" ln -nfs "$CLIENT_DIST_DIR/$VERSION" "$CLIENT_PUBLIC_DIR"
|
ssh -q "$TARGET" ln -nfs "$CLIENT_DIST_DIR/$VERSION" "$CLIENT_PUBLIC_DIR"
|
||||||
|
ssh -q "$TARGET" ls -lah "$CLIENT_DIST_DIR"
|
||||||
|
|
||||||
echo "restarting mnml service"
|
echo "restarting mnml service"
|
||||||
ssh -q -t "$TARGET" sudo service mnml restart && sleep 1 && systemctl --no-pager status mnml
|
ssh -q -t "$TARGET" sudo service mnml restart && sleep 1 && systemctl --no-pager status mnml
|
||||||
|
|||||||
@ -60,6 +60,16 @@
|
|||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.instance .info figure {
|
||||||
|
display: inline;
|
||||||
|
height: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.instance .info figcaption {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.instance .constructs {
|
.instance .constructs {
|
||||||
grid-area: constructs;
|
grid-area: constructs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mnml-client",
|
"name": "mnml-client",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -28,9 +28,16 @@ function InfoComponent(args) {
|
|||||||
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
||||||
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
||||||
|
|
||||||
|
const itemSource = itemInfo.combos.filter(c => c.item === info);
|
||||||
|
const itemSourceInfo = itemSource.length
|
||||||
|
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
|
||||||
|
: false;
|
||||||
|
const itemRegEx = /(Red|Blue|Green)/;
|
||||||
|
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
|
||||||
return (
|
return (
|
||||||
<div class="info-skill">
|
<div class="info-skill">
|
||||||
<h2>{fullInfo.item}</h2>
|
<h2>{fullInfo.item}</h2>
|
||||||
|
<h3>{itemSourceDescription}</h3>
|
||||||
<div> {infoDescription} </div>
|
<div> {infoDescription} </div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -100,9 +100,79 @@ module.exports = {
|
|||||||
{square(['red', 'blue'])}
|
{square(['red', 'blue'])}
|
||||||
<figcaption>Life</figcaption>
|
<figcaption>Life</figcaption>
|
||||||
</figure>,
|
</figure>,
|
||||||
|
LifeGGPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['green'])}
|
||||||
|
<figcaption>Life+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeRRPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['red'])}
|
||||||
|
<figcaption>Life+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
// Power Upgrades
|
LifeBBPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{square(['blue'])}
|
||||||
|
<figcaption>Life+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeRGPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['red', 'green'])}
|
||||||
|
<figcaption>Life+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeGBPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['green', 'blue'])}
|
||||||
|
<figcaption>Life+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeRBPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{square(['red', 'blue'])}
|
||||||
|
<figcaption>Life+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeGGPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['green'])}
|
||||||
|
<figcaption>Life++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeRRPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['red'])}
|
||||||
|
<figcaption>Life++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeBBPlusPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{square(['blue'])}
|
||||||
|
<figcaption>Life++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeRGPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['red', 'green'])}
|
||||||
|
<figcaption>Life++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeGBPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{square(['green', 'blue'])}
|
||||||
|
<figcaption>Life++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
LifeRBPlusPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{square(['red', 'blue'])}
|
||||||
|
<figcaption>Life++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
// Powers Upgrades
|
||||||
PowerGG: () =>
|
PowerGG: () =>
|
||||||
<figure>
|
<figure>
|
||||||
{circle(['green'])}
|
{circle(['green'])}
|
||||||
@ -138,8 +208,79 @@ module.exports = {
|
|||||||
{circle(['red', 'blue'])}
|
{circle(['red', 'blue'])}
|
||||||
<figcaption>Power</figcaption>
|
<figcaption>Power</figcaption>
|
||||||
</figure>,
|
</figure>,
|
||||||
|
PowerGGPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['green'])}
|
||||||
|
<figcaption>Power+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
// Speed Upgrades
|
PowerRRPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['red'])}
|
||||||
|
<figcaption>Power+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerBBPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{circle(['blue'])}
|
||||||
|
<figcaption>Power+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerRGPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['red', 'green'])}
|
||||||
|
<figcaption>Power+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerGBPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['green', 'blue'])}
|
||||||
|
<figcaption>Power+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerRBPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{circle(['red', 'blue'])}
|
||||||
|
<figcaption>Power+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerGGPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['green'])}
|
||||||
|
<figcaption>Power++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerRRPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['red'])}
|
||||||
|
<figcaption>Power++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerBBPlusPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{circle(['blue'])}
|
||||||
|
<figcaption>Power++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerRGPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['red', 'green'])}
|
||||||
|
<figcaption>Power++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerGBPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{circle(['green', 'blue'])}
|
||||||
|
<figcaption>Power++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
PowerRBPlusPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{circle(['red', 'blue'])}
|
||||||
|
<figcaption>Power++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
// Speeds Upgrades
|
||||||
SpeedGG: () =>
|
SpeedGG: () =>
|
||||||
<figure>
|
<figure>
|
||||||
{triangle(['green'])}
|
{triangle(['green'])}
|
||||||
@ -175,4 +316,75 @@ module.exports = {
|
|||||||
{triangle(['red', 'blue'])}
|
{triangle(['red', 'blue'])}
|
||||||
<figcaption>Speed</figcaption>
|
<figcaption>Speed</figcaption>
|
||||||
</figure>,
|
</figure>,
|
||||||
|
SpeedGGPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['green'])}
|
||||||
|
<figcaption>Speed+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedRRPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['red'])}
|
||||||
|
<figcaption>Speed+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedBBPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['blue'])}
|
||||||
|
<figcaption>Speed+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedRGPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['red', 'green'])}
|
||||||
|
<figcaption>Speed+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedGBPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['green', 'blue'])}
|
||||||
|
<figcaption>Speed+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedRBPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['red', 'blue'])}
|
||||||
|
<figcaption>Speed+</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedGGPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['green'])}
|
||||||
|
<figcaption>Speed++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedRRPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['red'])}
|
||||||
|
<figcaption>Speed++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedBBPlusPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['blue'])}
|
||||||
|
<figcaption>Speed++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedRGPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['red', 'green'])}
|
||||||
|
<figcaption>Speed++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedGBPlusPlus: () =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['green', 'blue'])}
|
||||||
|
<figcaption>Speed++</figcaption>
|
||||||
|
</figure>,
|
||||||
|
|
||||||
|
SpeedRBPlusPlus:() =>
|
||||||
|
<figure>
|
||||||
|
{triangle(['red', 'blue'])}
|
||||||
|
<figcaption>Speed++</figcaption>
|
||||||
|
</figure>,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -305,7 +305,6 @@ function Vbox(args) {
|
|||||||
|
|
||||||
const highlighted = combiner.indexOf(i) > -1;
|
const highlighted = combiner.indexOf(i) > -1;
|
||||||
const classes = `${highlighted ? 'highlight' : ''}`;
|
const classes = `${highlighted ? 'highlight' : ''}`;
|
||||||
|
|
||||||
if (shapes[v]) {
|
if (shapes[v]) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -223,8 +223,8 @@ function createSocket(events) {
|
|||||||
ItemInfo: onItemInfo,
|
ItemInfo: onItemInfo,
|
||||||
Pong: onPong,
|
Pong: onPong,
|
||||||
|
|
||||||
QueueRequested: () => console.log('pvp queue request received'),
|
QueueRequested: () => events.notify('pvp queue request received'),
|
||||||
QueueJoined: () => console.log('you have joined the pvp queue'),
|
QueueJoined: () => events.notify('you have joined the pvp queue'),
|
||||||
|
|
||||||
Error: errHandler,
|
Error: errHandler,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -228,6 +228,7 @@ function convertItem(v) {
|
|||||||
shapes.vboxColour(v.toLowerCase())
|
shapes.vboxColour(v.toLowerCase())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (shapes[v]) return shapes[v]();
|
||||||
return v || <span> </span>;
|
return v || <span> </span>;
|
||||||
// uncomment for double borders in vbox;
|
// uncomment for double borders in vbox;
|
||||||
// if (v) {
|
// if (v) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mnml-ops",
|
"name": "mnml-ops",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mnml"
|
name = "mnml"
|
||||||
version = "1.1.0"
|
version = "1.2.0"
|
||||||
authors = ["ntr <ntr@smokestack.io>"]
|
authors = ["ntr <ntr@smokestack.io>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -4,6 +4,7 @@ use std::collections::{HashMap, HashSet};
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use failure::{err_msg, format_err};
|
||||||
|
|
||||||
use crossbeam_channel::{Sender, Receiver};
|
use crossbeam_channel::{Sender, Receiver};
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ type Id = usize;
|
|||||||
pub struct PvpRequest {
|
pub struct PvpRequest {
|
||||||
pub id: Id,
|
pub id: Id,
|
||||||
pub tx: Sender<RpcMessage>,
|
pub tx: Sender<RpcMessage>,
|
||||||
pub account: Account,
|
pub account: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Events {
|
pub struct Events {
|
||||||
@ -37,8 +38,6 @@ pub struct Events {
|
|||||||
|
|
||||||
mail: Sender<Mail>,
|
mail: Sender<Mail>,
|
||||||
warden: Sender<GameEvent>,
|
warden: Sender<GameEvent>,
|
||||||
queue: Option<PvpRequest>,
|
|
||||||
|
|
||||||
clients: HashMap<Id, WsClient>,
|
clients: HashMap<Id, WsClient>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,13 +53,15 @@ pub enum Event {
|
|||||||
Push(Uuid, RpcMessage),
|
Push(Uuid, RpcMessage),
|
||||||
|
|
||||||
// client events
|
// client events
|
||||||
Queue(PvpRequest),
|
Queue(Id),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WsClient {
|
struct WsClient {
|
||||||
id: Id,
|
id: Id,
|
||||||
|
account: Option<Uuid>,
|
||||||
tx: Sender<RpcMessage>,
|
tx: Sender<RpcMessage>,
|
||||||
subs: HashSet<Uuid>,
|
subs: HashSet<Uuid>,
|
||||||
|
pvp: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Events {
|
impl Events {
|
||||||
@ -70,7 +71,6 @@ impl Events {
|
|||||||
rx,
|
rx,
|
||||||
warden,
|
warden,
|
||||||
mail,
|
mail,
|
||||||
queue: None,
|
|
||||||
clients: HashMap::new(),
|
clients: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ impl Events {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(format_err!("events error err={:?}", e));
|
warn!("events error err={:?}", e);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -110,7 +110,12 @@ impl Events {
|
|||||||
Event::Connect(id, account, tx) => {
|
Event::Connect(id, account, tx) => {
|
||||||
info!("connect id={:?} account={:?}", id, account);
|
info!("connect id={:?} account={:?}", id, account);
|
||||||
|
|
||||||
let client = WsClient { id, tx, subs: HashSet::new() };
|
let account_id = match account {
|
||||||
|
Some(a) => Some(a.id),
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let client = WsClient { id, tx, account: account_id, subs: HashSet::new(), pvp: false };
|
||||||
self.clients.insert(id, client);
|
self.clients.insert(id, client);
|
||||||
|
|
||||||
info!("clients={:?}", self.clients.len());
|
info!("clients={:?}", self.clients.len());
|
||||||
@ -181,24 +186,43 @@ impl Events {
|
|||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
|
||||||
Event::Queue(req) => {
|
Event::Queue(id) => {
|
||||||
info!("queue id={:?} account={:?}", req.id, req.account);
|
// check whether request is valid
|
||||||
|
{
|
||||||
|
let c = self.clients.get(&id)
|
||||||
|
.ok_or(format_err!("connection not found id={:?}", id))?;
|
||||||
|
|
||||||
self.queue = match self.queue {
|
if let None = c.account {
|
||||||
Some(ref q_req) => {
|
return Err(err_msg("cannot join pvp queue anonymously"));
|
||||||
info!("game queue pair found a={:?} b={:?}", req.account, q_req.account);
|
}
|
||||||
self.warden.send(GameEvent::Match((req, q_req.clone())))?;
|
|
||||||
None
|
|
||||||
},
|
|
||||||
None => {
|
|
||||||
info!("joined game queue id={:?} account={:?}", req.id, req.account);
|
|
||||||
Some(req)
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(())
|
info!("pvp queue request id={:?} account={:?}", c.id, c.account);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the req for the already queued opponent
|
||||||
|
if let Some(opp_req) = match self.clients.iter_mut().find(|(_c_id, c)| c.pvp) {
|
||||||
|
Some((q_id, q)) => {
|
||||||
|
q.pvp = false;
|
||||||
|
Some(PvpRequest { id: *q_id, account: q.account.unwrap(), tx: q.tx.clone() })
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
} {
|
||||||
|
// combine the requests and send to warden
|
||||||
|
let c = self.clients.get_mut(&id)
|
||||||
|
.ok_or(format_err!("connection not found id={:?}", id))?;
|
||||||
|
|
||||||
|
let player_req = PvpRequest { id: c.id, account: c.account.unwrap(), tx: c.tx.clone() };
|
||||||
|
self.warden.send(GameEvent::Match((opp_req, player_req)))?;
|
||||||
|
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// or flag the requester as pvp ready
|
||||||
|
let requester = self.clients.get_mut(&id).unwrap();
|
||||||
|
requester.pvp = true;
|
||||||
|
info!("joined game queue id={:?} account={:?}", requester.id, requester.account);
|
||||||
|
return Ok(());
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -691,9 +691,6 @@ pub fn instance_practice(tx: &mut Transaction, account: &Account) -> Result<Inst
|
|||||||
Ok(instance)
|
Ok(instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn instance_queue(tx: &mut Transaction, a: &Account, b: &Account) -> Result<Instance, Error> {
|
|
||||||
// }
|
|
||||||
|
|
||||||
pub fn pvp(tx: &mut Transaction, a: &Account, b: &Account) -> Result<Instance, Error> {
|
pub fn pvp(tx: &mut Transaction, a: &Account, b: &Account) -> Result<Instance, Error> {
|
||||||
let mut instance = Instance::new()
|
let mut instance = Instance::new()
|
||||||
// TODO generate nice game names
|
// TODO generate nice game names
|
||||||
|
|||||||
@ -44,139 +44,229 @@ pub enum Item {
|
|||||||
LifeRBPlusPlus,
|
LifeRBPlusPlus,
|
||||||
|
|
||||||
// Power Upgrades
|
// Power Upgrades
|
||||||
|
PowerGG,
|
||||||
PowerRR,
|
PowerRR,
|
||||||
PowerBB,
|
PowerBB,
|
||||||
PowerGG,
|
|
||||||
PowerRG,
|
PowerRG,
|
||||||
PowerGB,
|
PowerGB,
|
||||||
PowerRB,
|
PowerRB,
|
||||||
PowerRRPlus,
|
|
||||||
PowerGGPlus,
|
PowerGGPlus,
|
||||||
|
PowerRRPlus,
|
||||||
PowerBBPlus,
|
PowerBBPlus,
|
||||||
PowerRGPlus,
|
PowerRGPlus,
|
||||||
PowerGBPlus,
|
PowerGBPlus,
|
||||||
PowerRBPlus,
|
PowerRBPlus,
|
||||||
|
PowerGGPlusPlus,
|
||||||
PowerRRPlusPlus,
|
PowerRRPlusPlus,
|
||||||
PowerBBPlusPlus,
|
PowerBBPlusPlus,
|
||||||
PowerGGPlusPlus,
|
|
||||||
PowerRGPlusPlus,
|
PowerRGPlusPlus,
|
||||||
PowerGBPlusPlus,
|
PowerGBPlusPlus,
|
||||||
PowerRBPlusPlus,
|
PowerRBPlusPlus,
|
||||||
|
|
||||||
// Speed Upgrades
|
// Speed Upgrades
|
||||||
|
SpeedGG,
|
||||||
SpeedRR,
|
SpeedRR,
|
||||||
SpeedBB,
|
SpeedBB,
|
||||||
SpeedGG,
|
|
||||||
SpeedRG,
|
SpeedRG,
|
||||||
SpeedGB,
|
SpeedGB,
|
||||||
SpeedRB,
|
SpeedRB,
|
||||||
|
SpeedGGPlus,
|
||||||
SpeedRRPlus,
|
SpeedRRPlus,
|
||||||
SpeedBBPlus,
|
SpeedBBPlus,
|
||||||
SpeedGGPlus,
|
|
||||||
SpeedRGPlus,
|
SpeedRGPlus,
|
||||||
SpeedGBPlus,
|
SpeedGBPlus,
|
||||||
SpeedRBPlus,
|
SpeedRBPlus,
|
||||||
|
SpeedGGPlusPlus,
|
||||||
SpeedRRPlusPlus,
|
SpeedRRPlusPlus,
|
||||||
SpeedBBPlusPlus,
|
SpeedBBPlusPlus,
|
||||||
SpeedGGPlusPlus,
|
|
||||||
SpeedRGPlusPlus,
|
SpeedRGPlusPlus,
|
||||||
SpeedGBPlusPlus,
|
SpeedGBPlusPlus,
|
||||||
SpeedRBPlusPlus,
|
SpeedRBPlusPlus,
|
||||||
|
|
||||||
Amplify,
|
Amplify,
|
||||||
|
#[serde(rename = "Amplify+")]
|
||||||
AmplifyPlus,
|
AmplifyPlus,
|
||||||
|
#[serde(rename = "Amplify++")]
|
||||||
AmplifyPlusPlus,
|
AmplifyPlusPlus,
|
||||||
|
|
||||||
Absorb,
|
Absorb,
|
||||||
|
#[serde(rename = "Absorb+")]
|
||||||
AbsorbPlus,
|
AbsorbPlus,
|
||||||
|
#[serde(rename = "Absorb++")]
|
||||||
AbsorbPlusPlus,
|
AbsorbPlusPlus,
|
||||||
|
|
||||||
Banish,
|
Banish,
|
||||||
|
#[serde(rename = "Banish+")]
|
||||||
BanishPlus,
|
BanishPlus,
|
||||||
|
#[serde(rename = "Banish++")]
|
||||||
BanishPlusPlus,
|
BanishPlusPlus,
|
||||||
|
|
||||||
Bash,
|
Bash,
|
||||||
|
#[serde(rename = "Bash+")]
|
||||||
BashPlus,
|
BashPlus,
|
||||||
|
#[serde(rename = "Bash++")]
|
||||||
BashPlusPlus,
|
BashPlusPlus,
|
||||||
|
|
||||||
Blast,
|
Blast,
|
||||||
|
#[serde(rename = "Blast+")]
|
||||||
BlastPlus,
|
BlastPlus,
|
||||||
|
#[serde(rename = "Blast++")]
|
||||||
BlastPlusPlus,
|
BlastPlusPlus,
|
||||||
|
|
||||||
Chaos,
|
Chaos,
|
||||||
|
#[serde(rename = "Chaos+")]
|
||||||
ChaosPlus,
|
ChaosPlus,
|
||||||
|
#[serde(rename = "Chaos++")]
|
||||||
ChaosPlusPlus,
|
ChaosPlusPlus,
|
||||||
|
|
||||||
Sustain,
|
Sustain,
|
||||||
|
#[serde(rename = "Sustain+")]
|
||||||
SustainPlus,
|
SustainPlus,
|
||||||
|
#[serde(rename = "Sustain++")]
|
||||||
SustainPlusPlus,
|
SustainPlusPlus,
|
||||||
|
|
||||||
Electrify,
|
Electrify,
|
||||||
|
#[serde(rename = "Electrify+")]
|
||||||
ElectrifyPlus,
|
ElectrifyPlus,
|
||||||
|
#[serde(rename = "Electrify++")]
|
||||||
ElectrifyPlusPlus,
|
ElectrifyPlusPlus,
|
||||||
|
|
||||||
Curse,
|
Curse,
|
||||||
|
#[serde(rename = "Curse+")]
|
||||||
CursePlus,
|
CursePlus,
|
||||||
|
#[serde(rename = "Curse++")]
|
||||||
CursePlusPlus,
|
CursePlusPlus,
|
||||||
|
|
||||||
Decay,
|
Decay,
|
||||||
|
#[serde(rename = "Decay+")]
|
||||||
DecayPlus,
|
DecayPlus,
|
||||||
|
#[serde(rename = "Decay++")]
|
||||||
DecayPlusPlus,
|
DecayPlusPlus,
|
||||||
|
|
||||||
Hex,
|
Hex,
|
||||||
|
#[serde(rename = "Hex+")]
|
||||||
HexPlus,
|
HexPlus,
|
||||||
|
#[serde(rename = "Hex++")]
|
||||||
HexPlusPlus,
|
HexPlusPlus,
|
||||||
|
|
||||||
Haste,
|
Haste,
|
||||||
|
#[serde(rename = "Haste+")]
|
||||||
HastePlus,
|
HastePlus,
|
||||||
|
#[serde(rename = "Haste++")]
|
||||||
HastePlusPlus,
|
HastePlusPlus,
|
||||||
|
|
||||||
Heal,
|
Heal,
|
||||||
|
#[serde(rename = "Heal+")]
|
||||||
HealPlus,
|
HealPlus,
|
||||||
|
#[serde(rename = "Heal++")]
|
||||||
HealPlusPlus,
|
HealPlusPlus,
|
||||||
|
|
||||||
Hybrid,
|
Hybrid,
|
||||||
|
#[serde(rename = "Hybrid+")]
|
||||||
HybridPlus,
|
HybridPlus,
|
||||||
|
#[serde(rename = "Hybrid++")]
|
||||||
HybridPlusPlus,
|
HybridPlusPlus,
|
||||||
|
|
||||||
Invert,
|
Invert,
|
||||||
|
#[serde(rename = "Invert+")]
|
||||||
InvertPlus,
|
InvertPlus,
|
||||||
|
#[serde(rename = "Invert++")]
|
||||||
InvertPlusPlus,
|
InvertPlusPlus,
|
||||||
|
|
||||||
Counter,
|
Counter,
|
||||||
|
#[serde(rename = "Counter+")]
|
||||||
CounterPlus,
|
CounterPlus,
|
||||||
|
#[serde(rename = "Counter++")]
|
||||||
CounterPlusPlus,
|
CounterPlusPlus,
|
||||||
|
|
||||||
Purge,
|
Purge,
|
||||||
|
#[serde(rename = "Purge+")]
|
||||||
PurgePlus,
|
PurgePlus,
|
||||||
|
#[serde(rename = "Purge++")]
|
||||||
PurgePlusPlus,
|
PurgePlusPlus,
|
||||||
|
|
||||||
Purify,
|
Purify,
|
||||||
|
#[serde(rename = "Purify+")]
|
||||||
PurifyPlus,
|
PurifyPlus,
|
||||||
|
#[serde(rename = "Purify++")]
|
||||||
PurifyPlusPlus,
|
PurifyPlusPlus,
|
||||||
|
|
||||||
Reflect,
|
Reflect,
|
||||||
|
#[serde(rename = "Reflect+")]
|
||||||
ReflectPlus,
|
ReflectPlus,
|
||||||
|
#[serde(rename = "Reflect++")]
|
||||||
ReflectPlusPlus,
|
ReflectPlusPlus,
|
||||||
|
|
||||||
Recharge,
|
Recharge,
|
||||||
|
#[serde(rename = "Recharge+")]
|
||||||
RechargePlus,
|
RechargePlus,
|
||||||
|
#[serde(rename = "Recharge++")]
|
||||||
RechargePlusPlus,
|
RechargePlusPlus,
|
||||||
|
|
||||||
Ruin,
|
Ruin,
|
||||||
|
#[serde(rename = "Ruin+")]
|
||||||
RuinPlus,
|
RuinPlus,
|
||||||
|
#[serde(rename = "Ruin++")]
|
||||||
RuinPlusPlus,
|
RuinPlusPlus,
|
||||||
|
|
||||||
Link,
|
Link,
|
||||||
|
#[serde(rename = "Link+")]
|
||||||
LinkPlus,
|
LinkPlus,
|
||||||
|
#[serde(rename = "Link++")]
|
||||||
LinkPlusPlus,
|
LinkPlusPlus,
|
||||||
|
|
||||||
Silence,
|
Silence,
|
||||||
|
#[serde(rename = "Silence+")]
|
||||||
SilencePlus,
|
SilencePlus,
|
||||||
|
#[serde(rename = "Silence++")]
|
||||||
SilencePlusPlus,
|
SilencePlusPlus,
|
||||||
|
|
||||||
Slay,
|
Slay,
|
||||||
|
#[serde(rename = "Slay+")]
|
||||||
SlayPlus,
|
SlayPlus,
|
||||||
|
#[serde(rename = "Slay++")]
|
||||||
SlayPlusPlus,
|
SlayPlusPlus,
|
||||||
|
|
||||||
Sleep,
|
Sleep,
|
||||||
|
#[serde(rename = "Sleep+")]
|
||||||
SleepPlus,
|
SleepPlus,
|
||||||
|
#[serde(rename = "Sleep++")]
|
||||||
SleepPlusPlus,
|
SleepPlusPlus,
|
||||||
|
|
||||||
Restrict,
|
Restrict,
|
||||||
|
#[serde(rename = "Restrict+")]
|
||||||
RestrictPlus,
|
RestrictPlus,
|
||||||
|
#[serde(rename = "Restrict++")]
|
||||||
RestrictPlusPlus,
|
RestrictPlusPlus,
|
||||||
|
|
||||||
Strike,
|
Strike,
|
||||||
|
#[serde(rename = "Strike+")]
|
||||||
StrikePlus,
|
StrikePlus,
|
||||||
|
#[serde(rename = "Strike++")]
|
||||||
StrikePlusPlus,
|
StrikePlusPlus,
|
||||||
|
|
||||||
Siphon,
|
Siphon,
|
||||||
|
#[serde(rename = "Siphon+")]
|
||||||
SiphonPlus,
|
SiphonPlus,
|
||||||
|
#[serde(rename = "Siphon++")]
|
||||||
SiphonPlusPlus,
|
SiphonPlusPlus,
|
||||||
|
|
||||||
Intercept,
|
Intercept,
|
||||||
|
#[serde(rename = "Intercept+")]
|
||||||
InterceptPlus,
|
InterceptPlus,
|
||||||
|
#[serde(rename = "Intercept++")]
|
||||||
InterceptPlusPlus,
|
InterceptPlusPlus,
|
||||||
|
|
||||||
Break,
|
Break,
|
||||||
|
#[serde(rename = "Break+")]
|
||||||
BreakPlus,
|
BreakPlus,
|
||||||
|
#[serde(rename = "Break++")]
|
||||||
BreakPlusPlus,
|
BreakPlusPlus,
|
||||||
|
|
||||||
Triage,
|
Triage,
|
||||||
|
#[serde(rename = "Triage+")]
|
||||||
TriagePlus,
|
TriagePlus,
|
||||||
|
#[serde(rename = "Triage++")]
|
||||||
TriagePlusPlus,
|
TriagePlusPlus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ use ws::{listen, CloseCode, Message, Handler, Request, Response};
|
|||||||
use account::{Account};
|
use account::{Account};
|
||||||
use account;
|
use account;
|
||||||
use construct::{Construct};
|
use construct::{Construct};
|
||||||
use events::{Event, PvpRequest};
|
use events::{Event};
|
||||||
use game::{Game, game_state, game_skill, game_ready};
|
use game::{Game, game_state, game_skill, game_ready};
|
||||||
use instance::{Instance, instance_state, instance_practice, instance_ready};
|
use instance::{Instance, instance_state, instance_practice, instance_ready};
|
||||||
use item::{Item, ItemInfoCtr, item_info};
|
use item::{Item, ItemInfoCtr, item_info};
|
||||||
@ -132,8 +132,7 @@ impl Connection {
|
|||||||
// evented but authorization required
|
// evented but authorization required
|
||||||
match v {
|
match v {
|
||||||
RpcRequest::InstanceQueue {} => {
|
RpcRequest::InstanceQueue {} => {
|
||||||
let pvp = PvpRequest { id: self.id, account: account.clone(), tx: self.ws.clone() };
|
self.events.send(Event::Queue(self.id))?;
|
||||||
self.events.send(Event::Queue(pvp))?;
|
|
||||||
return Ok(RpcMessage::QueueRequested(()));
|
return Ok(RpcMessage::QueueRequested(()));
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use crossbeam_channel::{tick, Sender, Receiver};
|
|||||||
use postgres::transaction::Transaction;
|
use postgres::transaction::Transaction;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
|
||||||
|
use account;
|
||||||
use game::{games_need_upkeep, game_update, game_write, game_delete};
|
use game::{games_need_upkeep, game_update, game_write, game_delete};
|
||||||
use instance;
|
use instance;
|
||||||
use instance::{instances_need_upkeep, instances_idle, instance_update, instance_delete};
|
use instance::{instances_need_upkeep, instances_idle, instance_update, instance_delete};
|
||||||
@ -57,7 +58,7 @@ impl Warden {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(format_err!("err={:?}", e));
|
warn!("err={:?}", e);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -91,7 +92,11 @@ impl Warden {
|
|||||||
|
|
||||||
let db = self.pool.get()?;
|
let db = self.pool.get()?;
|
||||||
let mut tx = db.transaction()?;
|
let mut tx = db.transaction()?;
|
||||||
let instance = instance::pvp(&mut tx, &pair.0.account, &pair.1.account)?;
|
|
||||||
|
let a = account::select(&db, pair.0.account)?;
|
||||||
|
let b = account::select(&db, pair.1.account)?;
|
||||||
|
|
||||||
|
let instance = instance::pvp(&mut tx, &a, &b)?;
|
||||||
tx.commit()?;
|
tx.commit()?;
|
||||||
|
|
||||||
// subscribe users to instance events
|
// subscribe users to instance events
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user