MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / harvestFarm

Method harvestFarm

wxapp/junpinhui.js:355–379  ·  view source on GitHub ↗
(lands)

Source from the content-addressed store, hash-verified

353 }
354
355 async harvestFarm(lands) {
356 const candidates = lands.filter(isHarvestable);
357 if (!candidates.length) return false;
358
359 let acted = false;
360 try {
361 const data = await this.encryptedGet("/garden/Sorghum/harvestAll");
362 $.log(`账号[${this.index}] 一键收获成功: ${shortJson(data || "ok")}`);
363 return true;
364 } catch (e) {
365 $.log(`账号[${this.index}] 一键收获失败,尝试单块收获: ${e.message || e}`);
366 }
367
368 for (const land of candidates) {
369 try {
370 const data = await this.encryptedPost("/garden/sorghum/harvest", this.landPayload(land));
371 $.log(`账号[${this.index}] 收获成功: 地块${landNo(land)} ${shortJson(data || "ok")}`);
372 acted = true;
373 } catch (e) {
374 $.log(`账号[${this.index}] 收获失败[${landNo(land)}]: ${e.message || e}`);
375 }
376 await $.wait(500, 1200);
377 }
378 return acted;
379 }
380
381 async seedFarm(lands) {
382 const seedCount = Number(this.member.sorghum || 0);

Callers 1

runFarmAutomationMethod · 0.95

Calls 7

encryptedGetMethod · 0.95
encryptedPostMethod · 0.95
landPayloadMethod · 0.95
shortJsonFunction · 0.85
landNoFunction · 0.85
logMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected