(lands)
| 406 | } |
| 407 | |
| 408 | async waterFarm(lands) { |
| 409 | const waterCount = Number(this.member.water || 0); |
| 410 | if (waterCount <= 0) { |
| 411 | $.log(`账号[${this.index}] 无可用水滴,跳过浇水`); |
| 412 | return false; |
| 413 | } |
| 414 | const candidates = lands.filter(isGrowing); |
| 415 | if (!candidates.length) { |
| 416 | $.log(`账号[${this.index}] 未识别到可浇水地块`); |
| 417 | return false; |
| 418 | } |
| 419 | let acted = false; |
| 420 | const limit = Math.min(waterCount, candidates.length); |
| 421 | for (let i = 0; i < limit; i++) { |
| 422 | const land = candidates[i]; |
| 423 | try { |
| 424 | const data = await this.encryptedPost("/garden/sorghum/watering", this.landPayload(land)); |
| 425 | $.log(`账号[${this.index}] 浇水成功: 地块${landNo(land)} ${shortJson(data || "ok")}`); |
| 426 | acted = true; |
| 427 | } catch (e) { |
| 428 | $.log(`账号[${this.index}] 浇水失败[${landNo(land)}]: ${e.message || e}`); |
| 429 | } |
| 430 | await $.wait(500, 1200); |
| 431 | } |
| 432 | return acted; |
| 433 | } |
| 434 | |
| 435 | async manureFarm(lands) { |
| 436 | const manureCount = Number(this.member.manure || 0); |
no test coverage detected