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

Function selectCard

jd_factory_component.js:295–321  ·  view source on GitHub ↗
(cardInfo)

Source from the content-addressed store, hash-verified

293}
294
295function selectCard(cardInfo) {
296 return new Promise(async resolve => {
297 const random = Math.floor(Math.random() * 3);
298 const cardList = [...cardInfo].map((x, i) => {
299 return {
300 cardId: x.cardId,
301 cardPosition: i + 1,
302 cardStatus: i === random ? 1 : 0,
303 };
304 });
305 $.get(
306 taskStroyUrl('userinfo/SelectCard', `cardInfo=${encodeURIComponent(JSON.stringify({ cardInfo: cardList }))}`),
307 async (err, resp, data) => {
308 try {
309 const { ret, msg } = JSON.parse(data);
310 $.log(`\n选择翻倍卡片 ${msg}`);
311 await $.wait(10300);
312 await finishCard(cardInfo[random]);
313 } catch (e) {
314 $.logErr(e, resp);
315 } finally {
316 resolve();
317 }
318 },
319 );
320 });
321}
322
323function finishCard({ cardId }) {
324 return new Promise(async resolve => {

Callers 1

getReadyCardFunction · 0.70

Calls 6

taskStroyUrlFunction · 0.85
finishCardFunction · 0.70
getMethod · 0.45
logMethod · 0.45
waitMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected