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

Function GetPropCardCenterInfo

jd_cfd.js:291–333  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

289
290// 使用道具
291function GetPropCardCenterInfo() {
292 return new Promise((resolve) => {
293 $.get(taskUrl(`user/GetPropCardCenterInfo`), async (err, resp, data) => {
294 try {
295 if (err) {
296 console.log(JSON.stringify(err))
297 console.log(`${$.name} GetPropCardCenterInfo API请求失败,请检查网路重试`)
298 } else {
299 data = JSON.parse(data.replace(/\n/g, "").match(new RegExp(/jsonpCBK.?\((.*);*\)/))[1]);
300 if (data.iRet === 0) {
301 console.log(`使用道具卡`)
302 if (data.cardInfo.dwWorkingType === 0) {
303 $.canuse = false;
304 for (let key of Object.keys(data.cardInfo.coincard)) {
305 let vo = data.cardInfo.coincard[key]
306 if (vo.dwCardNums > 0) {
307 $.canuse = true;
308 await UsePropCard(vo.strCardTypeIndex)
309 break;
310 }
311 }
312 for (let key of Object.keys(data.cardInfo.richcard)) {
313 let vo = data.cardInfo.richcard[key]
314 if (vo.dwCardNums > 0) {
315 $.canuse = true;
316 await UsePropCard(vo.strCardTypeIndex)
317 break;
318 }
319 }
320 if (!$.canuse) console.log(`无可用道具卡`)
321 } else {
322 console.log(`有在使用中的道具卡,跳过使用`)
323 }
324 }
325 }
326 } catch (e) {
327 $.logErr(e, resp);
328 } finally {
329 resolve();
330 }
331 })
332 })
333}
334function UsePropCard(strCardTypeIndex) {
335 return new Promise((resolve) => {
336 let dwCardType = strCardTypeIndex.split("_")[0];

Callers 1

cfdFunction · 0.85

Calls 5

UsePropCardFunction · 0.85
taskUrlFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected