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

Method seedFarm

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

Source from the content-addressed store, hash-verified

379 }
380
381 async seedFarm(lands) {
382 const seedCount = Number(this.member.sorghum || 0);
383 if (seedCount <= 0) {
384 $.log(`账号[${this.index}] 无可用种子,跳过种植`);
385 return false;
386 }
387 const candidates = lands.filter(isPlantable);
388 if (!candidates.length) {
389 $.log(`账号[${this.index}] 未识别到可种植地块`);
390 return false;
391 }
392 let acted = false;
393 const limit = Math.min(seedCount, candidates.length);
394 for (let i = 0; i < limit; i++) {
395 const land = candidates[i];
396 try {
397 const data = await this.encryptedPost("/garden/sorghum/seed", this.landPayload(land));
398 $.log(`账号[${this.index}] 种植成功: 地块${landNo(land)} ${shortJson(data || "ok")}`);
399 acted = true;
400 } catch (e) {
401 $.log(`账号[${this.index}] 种植失败[${landNo(land)}]: ${e.message || e}`);
402 }
403 await $.wait(500, 1200);
404 }
405 return acted;
406 }
407
408 async waterFarm(lands) {
409 const waterCount = Number(this.member.water || 0);

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