(lands)
| 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); |
no test coverage detected