GamePortrait/src/utils/common.js

646 lines
14 KiB
JavaScript

// 百家乐&龙虎
const baccaratData = {
key: [
"banker_amount",
"player_amount",
"tie_amount",
"banker_pair_amount",
"player_pair_amount",
"big_amount",
"small_amount",
"luck_six_amount"
],
amount: {
banker_amount: 0,
player_amount: 0,
tie_amount: 0,
banker_pair_amount: 0,
player_pair_amount: 0,
big_amount: 0,
small_amount: 0,
luck_six_amount: 0
},
array: {
banker_amount: [],
player_amount: [],
tie_amount: [],
banker_pair_amount: [],
player_pair_amount: [],
big_amount: [],
small_amount: [],
luck_six_amount: []
}
}
// 牛牛
const nnData = {
key: [
"amount_player_1",
"amount_player_1_banker",
"amount_player_1_banker_times",
"amount_player_1_times",
"amount_player_2",
"amount_player_2_banker",
"amount_player_2_banker_times",
"amount_player_2_times",
"amount_player_3",
"amount_player_3_banker",
"amount_player_3_banker_times",
"amount_player_3_times"
],
amount: {
amount_player_1: 0,
amount_player_1_banker: 0,
amount_player_1_banker_times: 0,
amount_player_1_times: 0,
amount_player_2: 0,
amount_player_2_banker: 0,
amount_player_2_banker_times: 0,
amount_player_2_times: 0,
amount_player_3: 0,
amount_player_3_banker: 0,
amount_player_3_banker_times: 0,
amount_player_3_times: 0
},
array: {
amount_player_1: [],
amount_player_1_banker: [],
amount_player_1_banker_times: [],
amount_player_1_times: [],
amount_player_2: [],
amount_player_2_banker: [],
amount_player_2_banker_times: [],
amount_player_2_times: [],
amount_player_3: [],
amount_player_3_banker: [],
amount_player_3_banker_times: [],
amount_player_3_times: []
}
}
// 色碟
const toningData = {
key: [
"toning_zero",
"toning_four",
"toning_one",
"toning_three",
"toning_big",
"toning_small",
"toning_singular",
"toning_plural"
],
amount: {
toning_zero: 0,
toning_four: 0,
toning_one: 0,
toning_three: 0,
toning_big: 0,
toning_small: 0,
toning_singular: 0,
toning_plural: 0
},
array: {
toning_zero: [],
toning_four: [],
toning_one: [],
toning_three: [],
toning_big: [],
toning_small: [],
toning_singular: [],
toning_plural: []
}
}
// 骰宝
const diceData = {
key: [
"small",
"big",
"singular",
"plural",
"two_11",
"two_22",
"two_33",
"two_44",
"two_55",
"two_66",
"leopard",
"three_111",
"three_222",
"three_333",
"three_444",
"three_555",
"three_666",
"number_4",
"number_5",
"number_6",
"number_7",
"number_8",
"number_9",
"number_10",
"number_11",
"number_12",
"number_13",
"number_14",
"number_15",
"number_16",
"number_17",
"two_12",
"two_13",
"two_14",
"two_15",
"two_16",
"two_23",
"two_24",
"two_25",
"two_26",
"two_34",
"two_35",
"two_36",
"two_45",
"two_46",
"two_56",
"living_1",
"living_2",
"living_3",
"living_4",
"living_5",
"living_6"
],
amount: {
small: 0,
big: 0,
singular: 0,
plural: 0,
two_11: 0,
two_22: 0,
two_33: 0,
two_44: 0,
two_55: 0,
two_66: 0,
leopard: 0,
three_111: 0,
three_222: 0,
three_333: 0,
three_444: 0,
three_555: 0,
three_666: 0,
number_4: 0,
number_5: 0,
number_6: 0,
number_7: 0,
number_8: 0,
number_9: 0,
number_10: 0,
number_11: 0,
number_12: 0,
number_13: 0,
number_14: 0,
number_15: 0,
number_16: 0,
number_17: 0,
two_12: 0,
two_13: 0,
two_14: 0,
two_15: 0,
two_16: 0,
two_23: 0,
two_24: 0,
two_25: 0,
two_26: 0,
two_34: 0,
two_35: 0,
two_36: 0,
two_45: 0,
two_46: 0,
two_56: 0,
living_1: 0,
living_2: 0,
living_3: 0,
living_4: 0,
living_5: 0,
living_6: 0
},
array: {
small: [],
big: [],
singular: [],
plural: [],
two_11: [],
two_22: [],
two_33: [],
two_44: [],
two_55: [],
two_66: [],
leopard: [],
three_111: [],
three_222: [],
three_333: [],
three_444: [],
three_555: [],
three_666: [],
number_4: [],
number_5: [],
number_6: [],
number_7: [],
number_8: [],
number_9: [],
number_10: [],
number_11: [],
number_12: [],
number_13: [],
number_14: [],
number_15: [],
number_16: [],
number_17: [],
two_12: [],
two_13: [],
two_14: [],
two_15: [],
two_16: [],
two_23: [],
two_24: [],
two_25: [],
two_26: [],
two_34: [],
two_35: [],
two_36: [],
two_45: [],
two_46: [],
two_56: [],
living_1: [],
living_2: [],
living_3: [],
living_4: [],
living_5: [],
living_6: []
}
}
// 轮盘
const rouletteData = {
key: [
"low",
"even",
"red",
"black",
"odd",
"high",
"column_1",
"column_2",
"column_3",
"dozen_1",
"dozen_2",
"dozen_3",
"theThird",
"orphans",
"neighborsOfZero",
"zeroGame",
"straight_0",
"straight_1",
"straight_2",
"straight_3",
"straight_4",
"straight_5",
"straight_6",
"straight_7",
"straight_8",
"straight_9",
"straight_10",
"straight_11",
"straight_12",
"straight_13",
"straight_14",
"straight_15",
"straight_16",
"straight_17",
"straight_18",
"straight_19",
"straight_20",
"straight_21",
"straight_22",
"straight_23",
"straight_24",
"straight_25",
"straight_26",
"straight_27",
"straight_28",
"straight_29",
"straight_30",
"straight_31",
"straight_32",
"straight_33",
"straight_34",
"straight_35",
"straight_36"
],
amount: {
low: 0,
even: 0,
red: 0,
black: 0,
odd: 0,
high: 0,
column_1: 0,
column_2: 0,
column_3: 0,
dozen_1: 0,
dozen_2: 0,
dozen_3: 0,
theThird: 0,
orphans: 0,
neighborsOfZero: 0,
zeroGame: 0,
straight_0: 0,
straight_1: 0,
straight_2: 0,
straight_3: 0,
straight_4: 0,
straight_5: 0,
straight_6: 0,
straight_7: 0,
straight_8: 0,
straight_9: 0,
straight_10: 0,
straight_11: 0,
straight_12: 0,
straight_13: 0,
straight_14: 0,
straight_15: 0,
straight_16: 0,
straight_17: 0,
straight_18: 0,
straight_19: 0,
straight_20: 0,
straight_21: 0,
straight_22: 0,
straight_23: 0,
straight_24: 0,
straight_25: 0,
straight_26: 0,
straight_27: 0,
straight_28: 0,
straight_29: 0,
straight_31: 0,
straight_32: 0,
straight_33: 0,
straight_34: 0,
straight_35: 0,
straight_36: 0
},
array: {
low: [],
even: [],
red: [],
black: [],
odd: [],
high: [],
column_1: [],
column_2: [],
column_3: [],
dozen_1: [],
dozen_2: [],
dozen_3: [],
theThird: [],
orphans: [],
neighborsOfZero: [],
zeroGame: [],
straight_0: [],
straight_1: [],
straight_2: [],
straight_3: [],
straight_4: [],
straight_5: [],
straight_6: [],
straight_7: [],
straight_8: [],
straight_9: [],
straight_10: [],
straight_11: [],
straight_12: [],
straight_13: [],
straight_14: [],
straight_15: [],
straight_16: [],
straight_17: [],
straight_18: [],
straight_19: [],
straight_20: [],
straight_21: [],
straight_22: [],
straight_23: [],
straight_24: [],
straight_25: [],
straight_26: [],
straight_27: [],
straight_28: [],
straight_29: [],
straight_31: [],
straight_32: [],
straight_33: [],
straight_34: [],
straight_35: [],
straight_36: []
}
}
const breakOff = (data) => {
let new_data
try {
new_data = JSON.parse(JSON.stringify(data))
} catch (err) {
new_data = data
}
return new_data
}
const sendScanResult = (tableData, data) => {
if (tableData.game_id == 4 || tableData.game_id == 5) {
const order_num = parseInt(data.round.order_num)
if (tableData.game_id == 5) {
tableData.tc_result = tableData.tc_result ? tableData.tc_result : {}
}
if (tableData.nn_result) {
tableData.nn_result = tableData.nn_result ? tableData.nn_result : {}
}
if (order_num == 11) {
tableData.card_info.player_1_card_1 = data.round.card
} else if (order_num == 12) {
tableData.card_info.player_1_card_2 = data.round.card
} else if (order_num == 13) {
tableData.card_info.player_1_card_3 = data.round.card
if (tableData.game_id == 5) {
tableData.tc_result.player_1_result = data.round.result
}
} else if (order_num == 14) {
tableData.card_info.player_1_card_4 = data.round.card
} else if (order_num == 15) {
tableData.card_info.player_1_card_5 = data.round.card
if (tableData.game_id == 4) {
tableData.nn_result.player_1_result = data.round.result
}
} else if (order_num == 21) {
tableData.card_info.player_2_card_1 = data.round.card
} else if (order_num == 22) {
tableData.card_info.player_2_card_2 = data.round.card
} else if (order_num == 23) {
tableData.card_info.player_2_card_3 = data.round.card
if (tableData.game_id == 5) {
tableData.tc_result.player_2_result = data.round.result
}
} else if (order_num == 24) {
tableData.card_info.player_2_card_4 = data.round.card
} else if (order_num == 25) {
tableData.card_info.player_2_card_5 = data.round.card
if (tableData.game_id == 4) {
tableData.nn_result.player_2_result = data.round.result
}
} else if (order_num == 31) {
tableData.card_info.player_3_card_1 = data.round.card
} else if (order_num == 32) {
tableData.card_info.player_3_card_2 = data.round.card
} else if (order_num == 33) {
tableData.card_info.player_3_card_3 = data.round.card
if (tableData.game_id == 5) {
tableData.tc_result.player_3_result = data.round.result
}
} else if (order_num == 34) {
tableData.card_info.player_3_card_4 = data.round.card
} else if (order_num == 35) {
tableData.card_info.player_3_card_5 = data.round.card
if (tableData.game_id == 4) {
tableData.nn_result.player_3_result = data.round.result
}
} else if (order_num == 41) {
tableData.card_info.banker_card_1 = data.round.card
} else if (order_num == 42) {
tableData.card_info.banker_card_2 = data.round.card
} else if (order_num == 43) {
tableData.card_info.banker_card_3 = data.round.card
if (tableData.game_id == 5) {
tableData.tc_result.banker_result = data.round.result
}
} else if (order_num == 44) {
tableData.card_info.banker_card_4 = data.round.card
} else if (order_num == 45) {
tableData.card_info.banker_card_5 = data.round.card
if (tableData.game_id == 4) {
tableData.nn_result.banker_result = data.round.result
}
} else if (order_num == 0) {
tableData.card_info.card_first = data.round.card
}
} else if (tableData.game_id == 2) {
const position = parseInt(data.round.position)
if (position == 21) {
tableData.card_info.banker_1 = data.round.card
} else if (position == 11) {
tableData.card_info.player_1 = data.round.card
}
} else if (tableData.game_id == 1) {
const position = parseInt(data.round.position)
if (position == 21) {
tableData.card_info.banker_1 = data.round.card
} else if (position == 22) {
tableData.card_info.banker_2 = data.round.card
} else if (position == 23) {
tableData.card_info.banker_3 = data.round.card
} else if (position == 11) {
tableData.card_info.player_1 = data.round.card
} else if (position == 12) {
tableData.card_info.player_2 = data.round.card
} else if (position == 13) {
tableData.card_info.player_3 = data.round.card
}
}
}
const resetCardInfo = (tableData) => {
if (tableData.is_scavenging == 1) {
tableData.bet_status = 0
if (!tableData.card_info) {
tableData.card_info = {}
}
if (tableData.game_id == 4 || tableData.game_id == 5) {
tableData.card_info.player_1_card_1 = 0
tableData.card_info.player_1_card_2 = 0
tableData.card_info.player_1_card_3 = 0
tableData.card_info.player_1_card_4 = 0
tableData.card_info.player_1_card_5 = 0
tableData.card_info.player_2_card_1 = 0
tableData.card_info.player_2_card_2 = 0
tableData.card_info.player_2_card_3 = 0
tableData.card_info.player_2_card_4 = 0
tableData.card_info.player_2_card_5 = 0
tableData.card_info.player_3_card_1 = 0
tableData.card_info.player_3_card_2 = 0
tableData.card_info.player_3_card_3 = 0
tableData.card_info.player_3_card_4 = 0
tableData.card_info.player_3_card_5 = 0
tableData.card_info.banker_card_1 = 0
tableData.card_info.banker_card_2 = 0
tableData.card_info.banker_card_3 = 0
tableData.card_info.banker_card_4 = 0
tableData.card_info.banker_card_5 = 0
tableData.card_info.card_first = 0
} else if (tableData.game_id == 2) {
tableData.card_info.player_1 = 0
tableData.card_info.banker_1 = 0
} else if (tableData.game_id == 1) {
tableData.card_info.banker_1 = 0
tableData.card_info.banker_2 = 0
tableData.card_info.banker_3 = 0
tableData.card_info.player_1 = 0
tableData.card_info.player_2 = 0
tableData.card_info.player_3 = 0
}
}
}
const updateBetAmount = (tableData, data) => {
if (!tableData.bet_amount_msg) {
tableData.bet_amount_msg = {}
}
let key = []
if (tableData.game_id == 1 || tableData.game_id == 2) {
key = [...baccaratData.key]
} else if (tableData.game_id == 4 || tableData.game_id == 5) {
key = [...nnData.key]
} else if (tableData.game_id == 6) {
key = [...toningData.key]
} else if (tableData.game_id == 7) {
key = [...diceData.key]
}
if (key.length) {
key.forEach((v) => {
if (data && data.betAmountMsg && data.betAmountMsg[v]) {
tableData.bet_amount_msg[v] =
(tableData.bet_amount_msg[v] || 0) + data.betAmountMsg[v]
}
})
}
}
export {
sendScanResult,
resetCardInfo,
updateBetAmount,
breakOff,
baccaratData,
nnData,
diceData,
toningData,
rouletteData
}