fix: keep automatic cultivation on one stable primary per species
This commit is contained in:
@@ -659,17 +659,20 @@ class ServiceTests(unittest.TestCase):
|
||||
worker.schedule.clock = lambda: clock[0]
|
||||
worker.engine.last_heartbeat = clock[0]
|
||||
monsters = list(worker.engine.snapshot.monsters)
|
||||
# Use the primary so the request reaches the uncertainty barrier.
|
||||
species = str(worker.engine.snapshot.monsters[monsters[0]]["typeId"])
|
||||
recipient = int(worker.engine.cultivation.select(worker.engine.snapshot)[species]["id"])
|
||||
if kind == "gift":
|
||||
# Engine overlays confirmed gift timestamps in seconds,
|
||||
# while an unchanged raw server snapshot uses milliseconds.
|
||||
mon = next(row for row in worker.engine.client.raw["monsters"] if row["id"] == monsters[0])
|
||||
mon = next(row for row in worker.engine.client.raw["monsters"] if row["id"] == recipient)
|
||||
mon["giftTime"] = 1_700_000_000_000
|
||||
worker.engine.gift_planner.confirmed[monsters[0]] = {
|
||||
worker.engine.gift_planner.confirmed[recipient] = {
|
||||
"owner": str(worker.engine.snapshot.raw["master"]["id"]),
|
||||
"type": str(mon["typeId"]), "feel": int(mon.get("feel") or 0),
|
||||
"giftTime": 1_700_000_060}
|
||||
action = Action(kind, "Unconfirmed gift", "monsterService/monsterSendGift",
|
||||
{"monsterId": monsters[0], "itemId": 1})
|
||||
{"monsterId": recipient, "itemId": 1})
|
||||
elif kind == "hatch":
|
||||
slot = worker.engine.client.raw["stacks"][0]
|
||||
slot["monsterId"] = -1
|
||||
@@ -678,7 +681,7 @@ class ServiceTests(unittest.TestCase):
|
||||
worker.engine.pending_hatches = [action]
|
||||
else:
|
||||
action = Action(kind, "Unconfirmed feed", "monsterService/monsterIntensify",
|
||||
{"targetId": monsters[0], "foods": [monsters[1]]})
|
||||
{"targetId": recipient, "foods": [monsters[1]]})
|
||||
before = len(FakeClient.calls)
|
||||
with patch.object(worker.engine, "plans", return_value=[action]):
|
||||
if kind == "hatch":
|
||||
|
||||
Reference in New Issue
Block a user