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

Function doDailyTask

jd_fruit.js:140–239  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138 await showMsg();
139}
140async function doDailyTask() {
141 await taskInitForFarm();
142 console.log(`开始签到`);
143 if (!$.farmTask.signInit.todaySigned) {
144 await signForFarm(); //签到
145 if ($.signResult.code === "0") {
146 console.log(`【签到成功】获得${$.signResult.amount}g💧\\n`)
147 //message += `【签到成功】获得${$.signResult.amount}g💧\n`//连续签到${signResult.signDay}天
148 } else {
149 // message += `签到失败,详询日志\n`;
150 console.log(`签到结果: ${JSON.stringify($.signResult)}`);
151 }
152 } else {
153 console.log(`今天已签到,连续签到${$.farmTask.signInit.totalSigned},下次签到可得${$.farmTask.signInit.signEnergyEachAmount}g\n`);
154 }
155 // 被水滴砸中
156 console.log(`被水滴砸中: ${$.farmInfo.todayGotWaterGoalTask.canPop ? '是' : '否'}`);
157 if ($.farmInfo.todayGotWaterGoalTask.canPop) {
158 await gotWaterGoalTaskForFarm();
159 if ($.goalResult.code === '0') {
160 console.log(`【被水滴砸中】获得${$.goalResult.addEnergy}g💧\\n`);
161 // message += `【被水滴砸中】获得${$.goalResult.addEnergy}g💧\n`
162 }
163 }
164 console.log(`签到结束,开始广告浏览任务`);
165 if (!$.farmTask.gotBrowseTaskAdInit.f) {
166 let adverts = $.farmTask.gotBrowseTaskAdInit.userBrowseTaskAds
167 let browseReward = 0
168 let browseSuccess = 0
169 let browseFail = 0
170 for (let advert of adverts) { //开始浏览广告
171 if (advert.limit <= advert.hadFinishedTimes) {
172 // browseReward+=advert.reward
173 console.log(`${advert.mainTitle}+ ' 已完成`);//,获得${advert.reward}g
174 continue;
175 }
176 console.log('正在进行广告浏览任务: ' + advert.mainTitle);
177 await browseAdTaskForFarm(advert.advertId, 0);
178 if ($.browseResult.code === '0') {
179 console.log(`${advert.mainTitle}浏览任务完成`);
180 //领取奖励
181 await browseAdTaskForFarm(advert.advertId, 1);
182 if ($.browseRwardResult.code === '0') {
183 console.log(`领取浏览${advert.mainTitle}广告奖励成功,获得${$.browseRwardResult.amount}g`)
184 browseReward += $.browseRwardResult.amount
185 browseSuccess++
186 } else {
187 browseFail++
188 console.log(`领取浏览广告奖励结果: ${JSON.stringify($.browseRwardResult)}`)
189 }
190 } else {
191 browseFail++
192 console.log(`广告浏览任务结果: ${JSON.stringify($.browseResult)}`);
193 }
194 }
195 if (browseFail > 0) {
196 console.log(`【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\\n`);
197 // message += `【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\n`;

Callers 1

jdFruitFunction · 0.70

Calls 12

taskInitForFarmFunction · 0.85
signForFarmFunction · 0.85
gotWaterGoalTaskForFarmFunction · 0.85
browseAdTaskForFarmFunction · 0.85
gotThreeMealForFarmFunction · 0.85
doFriendsWaterFunction · 0.85
getAwardInviteFriendFunction · 0.85
clockInInFunction · 0.85
executeWaterRainsFunction · 0.85
getExtraAwardFunction · 0.85
turntableFarmFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected