修改匹配逻辑
This commit is contained in:
parent
21b9af6a28
commit
8baf552479
@ -23,8 +23,8 @@ export function getCardGroup(accountid: string, heroid: number, cardgroup: strin
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getUserInfo(accountid: string) {
|
export function getUserInfo(accountid: string, isMatch: boolean) {
|
||||||
return axios.get(`${ config.info_svr }/${ accountid }/uinfo`)
|
return axios.post(`${ config.info_svr }/${ accountid }/uinfo`, {isMatch})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
let res = response.data
|
let res = response.data
|
||||||
if (res.errcode) {
|
if (res.errcode) {
|
||||||
@ -123,7 +123,8 @@ export async function checkMatchTicket(accountid: string, matchid: string) {
|
|||||||
return axios(reqConfig).then(function (response) {
|
return axios(reqConfig).then(function (response) {
|
||||||
let res = response.data
|
let res = response.data
|
||||||
if (res.errcode) {
|
if (res.errcode) {
|
||||||
throw new Error(res.errmsg)
|
error(`check match ticket error with code: ${res.errcode}, msg: ${res.errmsg}`)
|
||||||
|
throw new Error(res.errcode)
|
||||||
} else {
|
} else {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { Client, generateId, matchMaker, Room, ServerError } from 'colyseus'
|
|||||||
import { BaseConst } from '../constants/BaseConst'
|
import { BaseConst } from '../constants/BaseConst'
|
||||||
import { IncomingMessage } from 'http'
|
import { IncomingMessage } from 'http'
|
||||||
import { checkMatchTicket } from '../common/WebApi'
|
import { checkMatchTicket } from '../common/WebApi'
|
||||||
|
import { error } from '../common/Debug'
|
||||||
|
|
||||||
interface MatchmakingGroup {
|
interface MatchmakingGroup {
|
||||||
averageRank: number;
|
averageRank: number;
|
||||||
@ -91,7 +92,8 @@ export class RankedLobbyRoom extends Room {
|
|||||||
try {
|
try {
|
||||||
await checkMatchTicket(accountid, this.matchid)
|
await checkMatchTicket(accountid, this.matchid)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new ServerError(11, 'not enough ticket')
|
let code = isNaN(err.message) ? 9: parseInt(err.message)
|
||||||
|
throw new ServerError(code, 'not enough ticket')
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ export class OnJoinCommand extends Command<CardGameState, {
|
|||||||
this.state.players.set(client.sessionId, player);
|
this.state.players.set(client.sessionId, player);
|
||||||
let uinfo: {nickname: string, avatar: string, score: number, accountid: string}
|
let uinfo: {nickname: string, avatar: string, score: number, accountid: string}
|
||||||
if (accountId && accountId != 'robot') {
|
if (accountId && accountId != 'robot') {
|
||||||
uinfo = await getUserInfo(accountId)
|
uinfo = await getUserInfo(accountId, !!this.room.match)
|
||||||
} else {
|
} else {
|
||||||
const fc = global.$cfg.get(BaseConst.FORMULA);
|
const fc = global.$cfg.get(BaseConst.FORMULA);
|
||||||
let low = (this.room.score * fc.get(70034).number / 100) | 0;
|
let low = (this.room.score * fc.get(70034).number / 100) | 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user