Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_REROLL));
}
),
takeEvery(
BUY_XP,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_XP));
}
),
takeEvery(
READY_UP,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.READY_UP));
}
),
takeEvery>(
BUY_CARD,
function*({ payload }) {
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_CARD, payload.index));
}
),
takeEvery>(
BoardActionTypes.SELL_PIECE,
function*({ payload }) {
yield put(sendPacket(ClientToServerPacketOpcodes.SELL_PIECE, payload.pieceId));
}
),
takeEvery>(
BoardActionTypes.PIECE_MOVED_TO_BOARD,
function*({ payload }) {
const packet: MovePiecePacket = {
id: payload.piece.id,
const writeActionsToPackets = function*() {
yield all([
takeEvery(
BATTLE_FINISHED,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.FINISH_MATCH));
}
),
takeEvery(
REROLL_CARDS,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_REROLL));
}
),
takeEvery(
BUY_XP,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_XP));
}
),
takeEvery(
READY_UP,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.READY_UP));
}
),
takeEvery>(
BUY_CARD,
function*({ payload }) {
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_CARD, payload.index));
}
yield takeLatest(GAME_STATE_UPDATE, function*(action) {
const stateLength = Constants.STATE_LENGTHS[action.payload.phase];
if (stateLength) {
yield put(bannerUpdatedAction(`${GameState[action.payload.phase]}, ${stateLength} seconds`));
}
const channel = yield call(countdown, stateLength);
yield takeEvery(channel, function*(secs) {
yield put(bannerUpdatedAction(`${GameState[action.payload.phase]}, ${secs} seconds`));
});
});
};
export const battle = function*(turnSimulator: TurnSimulator, turnCount: number, turnDuration: number) {
yield takeEvery(
START_BATTLE,
function*() {
const { board }: TState = yield select();
const battleChannel = yield call(battleEventChannel, turnSimulator, turnDuration, board, turnCount);
yield takeEvery(battleChannel, function*(battleAction: BattleAction) {
yield put(battleAction);
});
}
);
};
export default function* () {
yield takeEvery(GET_USER_DATA, handleGetUserData);
yield takeEvery(CREATE_NEW_TEMPLATE, handleCreateNewTemplate);
yield takeEvery(SET_TEMPLATE_DATA, handleSetTemplateData);
yield takeEvery(CHANGE_CHILD, handleChangeChild);
yield takeEvery(SET_USER_AND_TEMPLATE_DATA, handleSetUserAndTemplateData);
}
function*() {
const { board }: TState = yield select();
const battleChannel = yield call(battleEventChannel, turnSimulator, turnDuration, board, turnCount);
yield takeEvery(battleChannel, function*(battleAction: BattleAction) {
yield put(battleAction);
});
}
);
yield put(sendPacket(ClientToServerPacketOpcodes.MOVE_PIECE_TO_BOARD, packet));
}
),
takeEvery>(
BoardActionTypes.PIECE_MOVED_TO_BENCH,
function*({ payload }) {
const packet: MovePiecePacket = {
id: payload.piece.id,
from: payload.piece.position,
to: createTileCoordinates(payload.slot, null)
};
yield put(sendPacket(ClientToServerPacketOpcodes.MOVE_PIECE_TO_BENCH, packet));
}
),
takeEvery>(
SEND_CHAT_MESSAGE,
function*({ payload }) {
yield put(sendPacket(ClientToServerPacketOpcodes.SEND_CHAT_MESSAGE, payload.message));
}
),
takeEvery(
START_LOBBY_GAME,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.START_LOBBY_GAME));
}
),
takeEvery(
TOGGLE_SHOP_LOCK,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.TOGGLE_SHOP_LOCK));
}
export const loadPerspectiveDetailsSaga: Saga = function*() {
yield takeEvery(LOAD_PERSPECTIVE_DETAILS, loadPerspectiveDetails);
};
export default function* () {
yield takeEvery(GET_USER_DATA, handleGetUserData);
yield takeEvery(CREATE_NEW_TEMPLATE, handleCreateNewTemplate);
yield takeEvery(SET_TEMPLATE_DATA, handleSetTemplateData);
yield takeEvery(CHANGE_CHILD, handleChangeChild);
yield takeEvery(SET_USER_AND_TEMPLATE_DATA, handleSetUserAndTemplateData);
}
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_XP));
}
),
takeEvery(
READY_UP,
function*() {
yield put(sendPacket(ClientToServerPacketOpcodes.READY_UP));
}
),
takeEvery>(
BUY_CARD,
function*({ payload }) {
yield put(sendPacket(ClientToServerPacketOpcodes.BUY_CARD, payload.index));
}
),
takeEvery>(
BoardActionTypes.SELL_PIECE,
function*({ payload }) {
yield put(sendPacket(ClientToServerPacketOpcodes.SELL_PIECE, payload.pieceId));
}
),
takeEvery>(
BoardActionTypes.PIECE_MOVED_TO_BOARD,
function*({ payload }) {
const packet: MovePiecePacket = {
id: payload.piece.id,
from: payload.piece.position,
to: payload.position
};
yield put(sendPacket(ClientToServerPacketOpcodes.MOVE_PIECE_TO_BOARD, packet));
}