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

Method manureFarm

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

Source from the content-addressed store, hash-verified

433 }
434
435 async manureFarm(lands) {
436 const manureCount = Number(this.member.manure || 0);
437 if (manureCount <= 0) {
438 $.log(`账号[${this.index}] 无可用有机肥,跳过施肥/养护`);
439 return false;
440 }
441 const candidates = lands.filter(isGrowing);
442 if (!candidates.length) {
443 $.log(`账号[${this.index}] 未识别到可施肥/养护地块`);
444 return false;
445 }
446 let acted = false;
447 const limit = Math.min(manureCount, candidates.length);
448 for (let i = 0; i < limit; i++) {
449 const land = candidates[i];
450 try {
451 const data = await this.encryptedPost("/garden/sorghum/manuring", this.landPayload(land));
452 $.log(`账号[${this.index}] 施肥/养护成功: 地块${landNo(land)} ${shortJson(data || "ok")}`);
453 acted = true;
454 } catch (e) {
455 $.log(`账号[${this.index}] 施肥/养护失败[${landNo(land)}]: ${e.message || e}`);
456 }
457 await $.wait(500, 1200);
458 }
459 return acted;
460 }
461
462 async runFarmAutomation() {
463 const maxRounds = Number(process.env.junpinhui_farm_rounds || 5);

Callers 1

runFarmAutomationMethod · 0.95

Calls 6

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

Tested by

no test coverage detected