MCPcopy Create free account
hub / github.com/Semporia/Scripts / startGame

Function startGame

jd_mcxhd.js:274–302  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

272 })
273}
274function startGame() {
275 return new Promise(resolve => {
276 $.get(taskUrl('startGame'), async (err, resp, data) => {
277 try {
278 if (err) {
279 console.log(`${JSON.stringify(err)}`)
280 console.log(`${$.name} API请求失败,请检查网路重试`)
281 } else {
282 if (safeGet(data)) {
283 data = JSON.parse(data);
284 if (data.retCode === '200') {
285 console.log(`游戏开始成功`)
286 await $.wait(10*1000)
287 await reportGame(data.result.passScore + 2)
288 } else {
289 // if (data.retCode === '1102') $.canDo = false
290 console.log(`游戏开始失败`, JSON.stringify(data))
291 $.canDo = false
292 }
293 }
294 }
295 } catch (e) {
296 $.logErr(e, resp)
297 } finally {
298 resolve();
299 }
300 })
301 })
302}
303function reportGame(score) {
304 return new Promise(resolve => {
305 $.get(taskUrl('reportGame',{score:score}), async (err, resp, data) => {

Callers 1

superBoxFunction · 0.85

Calls 7

reportGameFunction · 0.85
taskUrlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
waitMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected