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

Function jump

jd_jump.js:72–187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 })
71
72async function jump() {
73 $.nowTime = new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000;
74 $.jumpList = [];
75 await getGameList();
76 if ($.jumpList.length === 0) {
77 console.log(`获取活动列表失败,请等待下一期活动\n`);
78 return;
79 }
80 await $.wait(1000);
81 for (let i = 0; i < $.jumpList.length; i++) {
82 $.jumpId = $.jumpList[i].id;
83 $.oneJumpInfo = {};
84 $.rewardList = [];
85 let oldReward = 0;
86 let newReward = 0;
87 await getOneJumpInfo();
88 if (JSON.stringify($.oneJumpInfo) === '{}') {
89 console.log(`获取ID为${$.jumpId}的活动详情失败`);
90 continue;
91 }
92 $.jumpName = $.oneJumpInfo.jumpActivityDetail.name;
93 if ($.oneJumpInfo.userInfo.userState === 'received') {
94 console.log(`${$.jumpName},活动已结束,已参与瓜分`);
95 console.log(`\n`);
96 continue;
97 } else if ($.oneJumpInfo.userInfo.userState === 'unreceive') {
98 $.shareBean = 0;
99 //瓜分
100 console.log(`${$.jumpName},瓜分京豆`);
101 await receive();
102 await $.wait(2000);
103 await rewards();
104 console.log(`瓜分获得${$.shareBean}京豆\n`);
105 continue;
106 } else if ($.nowTime > $.oneJumpInfo.jumpActivityDetail.endTime) {
107 console.log(`${$.jumpName},活动已结束`);
108 console.log(`\n`);
109 continue;
110 } else if ($.oneJumpInfo.userInfo.userState === 'complete') {
111 console.log(`${$.jumpName},已到达终点,等待瓜分,瓜分时间:${new Date($.oneJumpInfo.jumpActivityDetail.endTime)} 之后`);
112 console.log(`\n`);
113 break;
114 } else if ($.oneJumpInfo.userInfo.userState === 'playing') {
115 console.log(`开始执行活动:${$.jumpName},活动时间:${new Date($.oneJumpInfo.jumpActivityDetail.startTime).toLocaleString()}至${new Date($.oneJumpInfo.jumpActivityDetail.endTime).toLocaleString()}`);
116 } else {//complete
117 console.log(`异常`);
118 continue;
119 }
120 await $.wait(1000);
121 await getBeanRewards();
122 oldReward = await getReward();
123 console.log(`已获得京豆:${oldReward}`);
124 await $.wait(1000);
125 $.taskList = [];
126 await getTaskList();
127 await $.wait(1000);
128 await doTask();
129 if ($.oneJumpInfo.userInfo.gridTaskDone === false) {

Callers 1

jd_jump.jsFile · 0.85

Calls 12

getGameListFunction · 0.85
getOneJumpInfoFunction · 0.85
rewardsFunction · 0.85
getBeanRewardsFunction · 0.85
domissionFunction · 0.85
throwDiceFunction · 0.85
receiveFunction · 0.70
getRewardFunction · 0.70
getTaskListFunction · 0.70
doTaskFunction · 0.70
logMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected