Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cardcore/game

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cardcore/game - npm Package Compare versions

Comparing version 0.0.1-1f746c46 to 0.0.1-e610b5ce

21

dist/index.js

@@ -6,2 +6,3 @@ "use strict";

});
exports.gameReducer = undefined;

@@ -163,8 +164,18 @@ var _attack = require("./attack");

});
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var gameReducer = exports.gameReducer = function gameReducer(state, action) {
// initialization
if (action.type === "@@INIT") {
// On this one, clear out both the nextActions queue and the players list... this is the first
// person joining. Everyone else joins with JOIN_GAME
if (action.type === _startGame.CREATE_GAME) {
return Object.assign({}, state, {
game: {
nextActions: [],
startTime: action.startTime,
nextActions: [{
action: { type: _startGame.JOIN_GAME },
// lol lol lol hack hack hack
notPlayerId: action._sender
}],
allowedActions: {},

@@ -176,3 +187,3 @@ playerOrder: [],

started: false,
players: {},
players: _defineProperty({}, action._sender, {}),
units: {},

@@ -185,6 +196,6 @@ randoSeeds: {},

if (action._prev) {
if (action.prev) {
return Object.assign({}, state, {
game: Object.assign({}, state.game, {
prev: action._prev
prev: action.prev
})

@@ -191,0 +202,0 @@ });

@@ -12,3 +12,3 @@ "use strict";

var _ssbKeys = require("ssb-keys");
var _ssbKeys = require("@streamplace/ssb-keys");

@@ -15,0 +15,0 @@ var _ssbKeys2 = _interopRequireDefault(_ssbKeys);

@@ -12,3 +12,3 @@ "use strict";

var _ssbKeys = require("ssb-keys");
var _ssbKeys = require("@streamplace/ssb-keys");

@@ -15,0 +15,0 @@ var _ssbKeys2 = _interopRequireDefault(_ssbKeys);

@@ -16,3 +16,3 @@ "use strict";

var _ssbKeys = require("ssb-keys");
var _ssbKeys = require("@streamplace/ssb-keys");

@@ -19,0 +19,0 @@ var _ssbKeys2 = _interopRequireDefault(_ssbKeys);

@@ -6,3 +6,3 @@ "use strict";

});
exports.START_GAME = exports.ORDER_PLAYERS = exports.JOIN_GAME_ACCEPT = exports.joinGameStart = exports.JOIN_GAME_START = undefined;
exports.createGame = exports.CREATE_GAME = exports.START_GAME = exports.ORDER_PLAYERS = exports.JOIN_GAME = undefined;
exports.startGameReducer = startGameReducer;

@@ -22,15 +22,16 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var JOIN_GAME_START = exports.JOIN_GAME_START = "JOIN_GAME_START";
var joinGameStart = exports.joinGameStart = function joinGameStart() {
var JOIN_GAME = exports.JOIN_GAME = "JOIN_GAME";
var ORDER_PLAYERS = exports.ORDER_PLAYERS = "ORDER_PLAYERS";
var START_GAME = exports.START_GAME = "START_GAME";
var CREATE_GAME = exports.CREATE_GAME = "CREATE_GAME";
var createGame = exports.createGame = function createGame() {
return {
type: JOIN_GAME_START
type: CREATE_GAME,
startTime: Date.now()
};
};
var JOIN_GAME_ACCEPT = exports.JOIN_GAME_ACCEPT = "JOIN_GAME_ACCEPT";
var ORDER_PLAYERS = exports.ORDER_PLAYERS = "ORDER_PLAYERS";
var START_GAME = exports.START_GAME = "START_GAME";

@@ -47,18 +48,3 @@ var INITIAL_PLAYER = {

function startGameReducer(state, action) {
if (action.type === JOIN_GAME_START) {
// On this one, clear out both the nextActions queue and the players list... this is the first
// person joining. Everyone else joins with JOIN_GAME_ACCEPT
return Object.assign({}, state, {
game: Object.assign({}, state.game, {
players: _defineProperty({}, action._sender, {}),
nextActions: [{
action: { type: JOIN_GAME_ACCEPT },
// lol lol lol hack hack hack
notPlayerId: action._sender
}]
})
});
}
if (action.type === JOIN_GAME_ACCEPT) {
if (action.type === JOIN_GAME) {
var lexicalPlayers = [].concat(_toConsumableArray(Object.keys(state.game.players)), [action._sender]).sort();

@@ -65,0 +51,0 @@ return Object.assign({}, state, {

{
"name": "@cardcore/game",
"version": "0.0.1-1f746c46",
"version": "0.0.1-e610b5ce",
"description": "base rules for the Streamplace card game",

@@ -13,3 +13,6 @@ "main": "dist/index.js",

},
"gitHead": "1f746c46c9911e36a1e9be89edf6da902e8ff20f"
"dependencies": {
"@streamplace/ssb-keys": "^7.0.16"
},
"gitHead": "e610b5ce494b91bf26736417e3c8ba011f27ae84"
}

@@ -15,9 +15,20 @@ export * from "./attack";

import { CREATE_GAME, JOIN_GAME } from "./start-game";
export const gameReducer = (state, action) => {
// initialization
if (action.type === "@@INIT") {
// On this one, clear out both the nextActions queue and the players list... this is the first
// person joining. Everyone else joins with JOIN_GAME
if (action.type === CREATE_GAME) {
return {
...state,
game: {
nextActions: [],
startTime: action.startTime,
nextActions: [
{
action: { type: JOIN_GAME },
// lol lol lol hack hack hack
notPlayerId: action._sender
}
],
allowedActions: {},

@@ -29,3 +40,5 @@ playerOrder: [],

started: false,
players: {},
players: {
[action._sender]: {}
},
units: {},

@@ -38,3 +51,3 @@ randoSeeds: {},

if (action._prev) {
if (action.prev) {
return {

@@ -44,3 +57,3 @@ ...state,

...state.game,
prev: action._prev
prev: action.prev
}

@@ -47,0 +60,0 @@ };

@@ -1,2 +0,2 @@

import ssbKeys from "ssb-keys";
import ssbKeys from "@streamplace/ssb-keys";
import { SEED_RNG } from "./seed-rng";

@@ -3,0 +3,0 @@ import { CHECK_DEATH } from "./check-death";

@@ -1,2 +0,2 @@

import ssbKeys from "ssb-keys";
import ssbKeys from "@streamplace/ssb-keys";
import { clientGenerateKey } from "@cardcore/client";

@@ -3,0 +3,0 @@ import { rando } from "@cardcore/util";

import { rotateArray, shuffle } from "@cardcore/util";
import { clientGenerateKey, clientBox } from "@cardcore/client";
import ssbKeys from "ssb-keys";
import ssbKeys from "@streamplace/ssb-keys";

@@ -5,0 +5,0 @@ export const SHUFFLE_DECK = "SHUFFLE_DECK";

@@ -8,11 +8,12 @@ import { SEED_RNG } from "./seed-rng";

export const JOIN_GAME_START = "JOIN_GAME_START";
export const joinGameStart = () => {
export const JOIN_GAME = "JOIN_GAME";
export const ORDER_PLAYERS = "ORDER_PLAYERS";
export const START_GAME = "START_GAME";
export const CREATE_GAME = "CREATE_GAME";
export const createGame = () => {
return {
type: JOIN_GAME_START
type: CREATE_GAME,
startTime: Date.now()
};
};
export const JOIN_GAME_ACCEPT = "JOIN_GAME_ACCEPT";
export const ORDER_PLAYERS = "ORDER_PLAYERS";
export const START_GAME = "START_GAME";

@@ -29,24 +30,3 @@ const INITIAL_PLAYER = {

export function startGameReducer(state, action) {
if (action.type === JOIN_GAME_START) {
// On this one, clear out both the nextActions queue and the players list... this is the first
// person joining. Everyone else joins with JOIN_GAME_ACCEPT
return {
...state,
game: {
...state.game,
players: {
[action._sender]: {}
},
nextActions: [
{
action: { type: JOIN_GAME_ACCEPT },
// lol lol lol hack hack hack
notPlayerId: action._sender
}
]
}
};
}
if (action.type === JOIN_GAME_ACCEPT) {
if (action.type === JOIN_GAME) {
let lexicalPlayers = [

@@ -53,0 +33,0 @@ ...Object.keys(state.game.players),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc