BlueGit

timfa questward

Files

questward / server / src / courier / service.js

service.js

tweaks to sprites, shading
timfa Tim Falken · pushed by timfa · 2 months ago
48b50124 History
service.js 20.7 KiB Download Raw
1import { CHUNK_SIZE } from "../../../shared/protocol/constants.js";
2import { BlockType } from "../../../shared/definitions/tiles.js";
3import { MobId, mobDefinition, mobSpriteName } from "../../../shared/definitions/mobs.js";
4import { ItemId, itemDefinition } from "../../../shared/definitions/items.js";
5import { insertStack, insertStackGrowable, takeFromSlot, emptySlots, normalizeVault } from "../../../shared/items/inventory.js";
6import { advanceCourierFlight } from "../../../shared/courier/flight.js";
7import { GAIT } from "../../../shared/protocol/constants.js";
8import { decodeChunkBlob } from "../world/chunkData.js";
9import { findReservedChequeIndex } from "../items/bags.js";
10import { randomUUID } from "node:crypto";
11import {
12 BANK_LETTER_AUTHOR,
13 bankRestNoticeLetterBody,
14 isBankRestNoticeLetter,
15 isCentralExchangeLetter,
16 itemNameForNotice,
17 mergeBankRestNoticeLines,
18 sourceNameForVaultDeposit
19} from "../../../shared/courier/bankNotice.js";
20
21export class CourierService
22{
23 constructor ({ stateDb, worldDb, simulation })
24 {
25 this.stateDb = stateDb;
26 this.worldDb = worldDb;
27 this.simulation = simulation;
28 this.bankTiles = [];
29 this.refreshBankIndex();
30 }
31
32 refreshBankIndex ()
33 {
34 const revisionId = this.worldDb.getActiveRevisionId();
35 const banks = [];
36 for (const coord of this.worldDb.listChunkCoords(revisionId))
37 {
38 const row = this.worldDb.getChunkVersion(coord.chunk_x, coord.chunk_y, revisionId);
39 if (!row)
40 { continue; }
41 const data = decodeChunkBlob(row.data_blob, this.simulation.settings.defaultGroundTypeId);
42 for (let localY = 0; localY < CHUNK_SIZE; localY++)
43 {
44 for (let localX = 0; localX < CHUNK_SIZE; localX++)
45 {
46 const block = data.blocks[localY * CHUNK_SIZE + localX];
47 if (block?.typeId !== BlockType.bank)
48 { continue; }
49 banks.push({
50 tileX: coord.chunk_x * CHUNK_SIZE + localX,
51 tileY: coord.chunk_y * CHUNK_SIZE + localY
52 });
53 }
54 }
55 }
56 this.bankTiles = banks;
57 }
58
59 nearestBank (tileX, tileY)
60 {
61 if (!this.bankTiles.length)
62 { return null; }
63 let best = null;
64 let bestDist = Infinity;
65 for (const bank of this.bankTiles)
66 {
67 const dist = Math.hypot(bank.tileX - tileX, bank.tileY - tileY);
68 if (dist < bestDist)
69 {
70 bestDist = dist;
71 best = bank;
72 }
73 }
74 return best;
75 }
76
77 /**
78 * Player dispatch: cargo is money or one inventory stack.
79 * destination: { kind: "bank" } | { kind: "player", firstName, lastName }
80 */
81 dispatchFromPlayer ({ characterId, originTileX, originTileY, destination, cargo })
82 {
83 const onlineId = this.simulation.characterEntities.get(characterId);
84 const bag = onlineId
85 ? this.simulation.bagOf(onlineId)
86 : this.stateDb.getBag(characterId);
87 if (!bag)
88 {
89 const error = new Error("No bag.");
90 error.userFacing = true;
91 throw error;
92 }
93
94 let takenCargo;
95 if (cargo?.kind === "item")
96 {
97 const slot = bag.inventory?.[cargo.slotIndex | 0];
98 if (slot?.itemId === ItemId.blankCheque)
99 {
100 const error = new Error("Blank cheques cannot be sent by pigeon.");
101 error.userFacing = true;
102 throw error;
103 }
104 if (slot?.itemId === ItemId.letter)
105 {
106 if (Number(slot.instance?.authorCharacterId) !== Number(characterId))
107 {
108 const error = new Error("You can only send letters you wrote.");
109 error.userFacing = true;
110 throw error;
111 }
112 }
113 const taken = takeFromSlot(bag.inventory, cargo.slotIndex | 0, cargo.quantity ?? null);
114 if (!taken.ok || !taken.taken)
115 {
116 const error = new Error("That item is not available.");
117 error.userFacing = true;
118 throw error;
119 }
120 bag.inventory = taken.slots;
121 const stack = taken.taken;
122 if (stack.itemId === ItemId.letter && stack.instance)
123 { stack.instance = { ...stack.instance, opened: false }; }
124 takenCargo = { kind: "item", stack };
125 }
126 else
127 {
128 const error = new Error("Pigeon cargo must be money or one item stack.");
129 error.userFacing = true;
130 throw error;
131 }
132
133 const dest = this.#resolveDestination(destination, originTileX, originTileY);
134 this.#persistBag(characterId, bag);
135 const transit = this.stateDb.insertCourierTransit({
136 senderCharacterId: characterId,
137 destinationKind: dest.kind,
138 destinationCharacterId: dest.characterId ?? null,
139 vaultCharacterId: dest.vaultCharacterId ?? null,
140 cargo: takenCargo,
141 originX: originTileX + 0.5,
142 originY: originTileY + 0.5,
143 destX: dest.tileX + 0.5,
144 destY: dest.tileY + 0.5,
145 traveled: 0,
146 status: "in_transit",
147 entityId: null
148 });
149 return { transit, bag };
150 }
151
152 /**
153 * Market / system dispatch already holding cargo (no bag take).
154 * When the recipient is offline, holds delivery until login (CE letters, etc.).
155 */
156 dispatchHeldCargo ({ senderCharacterId, originTileX, originTileY, destination, cargo, vaultCharacterId = null })
157 {
158 const recipientId = vaultCharacterId ?? senderCharacterId;
159 if (!this.simulation.isCharacterOnline(recipientId))
160 {
161 const dest = this.#resolveDestination(destination, originTileX, originTileY);
162 this.stateDb.insertHeldCourierDelivery({
163 characterId: recipientId,
164 senderCharacterId,
165 originTileX,
166 originTileY,
167 destinationKind: dest.kind,
168 destinationCharacterId: dest.characterId ?? recipientId,
169 vaultCharacterId: vaultCharacterId ?? dest.vaultCharacterId ?? recipientId,
170 cargo
171 });
172 return null;
173 }
174 const dest = this.#resolveDestination(destination, originTileX, originTileY);
175 return this.stateDb.insertCourierTransit({
176 senderCharacterId,
177 destinationKind: dest.kind,
178 destinationCharacterId: dest.characterId ?? null,
179 vaultCharacterId: vaultCharacterId ?? dest.vaultCharacterId ?? null,
180 cargo,
181 originX: originTileX + 0.5,
182 originY: originTileY + 0.5,
183 destX: dest.tileX + 0.5,
184 destY: dest.tileY + 0.5,
185 traveled: 0,
186 status: "in_transit",
187 entityId: null
188 });
189 }
190
191 /** Flush offline-held deliveries and send a bank resting notice when the player enters the world. */
192 onCharacterEnteredWorld (characterId, tileX, tileY)
193 {
194 for (const held of this.stateDb.listHeldCourierDeliveries(characterId))
195 {
196 this.stateDb.deleteHeldCourierDelivery(held.holdId);
197 const row = this.stateDb.getCharacter(held.destinationCharacterId ?? characterId);
198 this.dispatchHeldCargo({
199 senderCharacterId: held.senderCharacterId,
200 originTileX: held.originTileX,
201 originTileY: held.originTileY,
202 destination: held.destinationKind === "bank"
203 ? { kind: "bank" }
204 : {
205 kind: "player",
206 firstName: row?.first_name ?? "Unknown",
207 lastName: row?.last_name ?? ""
208 },
209 cargo: held.cargo,
210 vaultCharacterId: held.vaultCharacterId ?? characterId
211 });
212 }
213 const noticeTransit = this.#dispatchBankRestNotice(characterId, tileX, tileY);
214 void noticeTransit;
215 }
216
217 step (now, dt)
218 {
219 const events = [];
220 const settings = this.simulation.settings;
221 for (const transit of this.stateDb.listActiveCourierTransits())
222 {
223 this.#retargetPlayerDest(transit);
224 const advanced = advanceCourierFlight({
225 originX: transit.originX,
226 originY: transit.originY,
227 destX: transit.destX,
228 destY: transit.destY,
229 traveled: transit.traveled,
230 dt,
231 settings
232 });
233 transit.traveled = advanced.traveled;
234 transit.updatedAt = now;
235
236 if (advanced.arrived)
237 {
238 events.push(...this.#deliver(transit, now));
239 continue;
240 }
241
242 events.push(...this.#syncVisiblePigeon(transit, advanced, now));
243 this.stateDb.updateCourierTransit(transit);
244 }
245 return events;
246 }
247
248 #retargetPlayerDest (transit)
249 {
250 if (transit.destinationKind !== "player" || !transit.destinationCharacterId)
251 { return; }
252 const onlineId = this.simulation.characterEntities.get(transit.destinationCharacterId);
253 if (onlineId)
254 {
255 const pos = this.simulation.positionOf(onlineId);
256 if (pos)
257 {
258 transit.destX = pos.tileX + 0.5;
259 transit.destY = pos.tileY + 0.5;
260 }
261 return;
262 }
263 this.#routeTransitToBank(transit, transit.destinationCharacterId);
264 }
265
266 #routeTransitToBank (transit, vaultCharacterId)
267 {
268 const bank = this.nearestBank(Math.floor(transit.destX), Math.floor(transit.destY))
269 ?? this.nearestBank(Math.floor(transit.originX), Math.floor(transit.originY));
270 if (!bank)
271 { return; }
272 transit.destinationKind = "bank";
273 transit.vaultCharacterId = vaultCharacterId ?? transit.vaultCharacterId ?? transit.destinationCharacterId ?? transit.senderCharacterId;
274 transit.destX = bank.tileX + 0.5;
275 transit.destY = bank.tileY + 0.5;
276 }
277
278 #resolveDestination (destination, originTileX, originTileY)
279 {
280 if (destination?.kind === "player")
281 {
282 const character = this.stateDb.getCharacterByName(destination.firstName, destination.lastName);
283 if (!character)
284 {
285 const error = new Error("No character with that name.");
286 error.userFacing = true;
287 throw error;
288 }
289 const onlineId = this.simulation.characterEntities.get(character.character_id);
290 if (!onlineId)
291 {
292 const bank = this.nearestBank(originTileX, originTileY)
293 ?? this.nearestBank(character.tile_x, character.tile_y);
294 if (!bank)
295 {
296 const error = new Error("No bank exists in the world yet.");
297 error.userFacing = true;
298 throw error;
299 }
300 return {
301 kind: "bank",
302 characterId: character.character_id,
303 vaultCharacterId: character.character_id,
304 tileX: bank.tileX,
305 tileY: bank.tileY
306 };
307 }
308 const pos = this.simulation.positionOf(onlineId);
309 return {
310 kind: "player",
311 characterId: character.character_id,
312 tileX: pos.tileX,
313 tileY: pos.tileY
314 };
315 }
316 if (destination?.kind === "bank")
317 {
318 const bank = this.nearestBank(originTileX, originTileY);
319 if (!bank)
320 {
321 const error = new Error("No bank exists in the world yet.");
322 error.userFacing = true;
323 throw error;
324 }
325 return { kind: "bank", tileX: bank.tileX, tileY: bank.tileY };
326 }
327 const error = new Error("Pigeon destination must be bank or player.");
328 error.userFacing = true;
329 throw error;
330 }
331
332 #syncVisiblePigeon (transit, advanced, now)
333 {
334 const events = [];
335 const tileX = Math.floor(advanced.x);
336 const tileY = Math.floor(advanced.y);
337 if (!this.simulation.chunkIsSimulating(tileX, tileY))
338 {
339 if (transit.entityId)
340 {
341 this.simulation.despawnEntity(transit.entityId);
342 events.push({ type: "entity-despawn", entityId: transit.entityId, tileX, tileY });
343 transit.entityId = null;
344 }
345 return events;
346 }
347
348 if (!transit.entityId || !this.simulation.entityRecord(transit.entityId))
349 {
350 transit.entityId = null;
351 const def = mobDefinition(MobId.pigeon);
352 const entityId = this.simulation.spawnEntity({
353 position: { tileX, tileY },
354 movement: { gait: GAIT.walk, walkCarry: 0 },
355 path: { tiles: [] },
356 flight: {
357 x: advanced.x,
358 y: advanced.y,
359 targetX: transit.destX,
360 targetY: transit.destY,
361 speed: advanced.speed,
362 nextPickAt: now + 60_000,
363 lastAt: now,
364 courierId: transit.courierId
365 },
366 appearance: {
367 sex: def.sex,
368 firstName: def.displayName,
369 lastName: "",
370 sprite: mobSpriteName(MobId.pigeon)
371 },
372 creature: { mobTypeId: MobId.pigeon },
373 health: { current: 1, max: 1 }
374 }, { requireResident: true });
375 if (entityId != null)
376 { transit.entityId = entityId; }
377 return events;
378 }
379
380 const moved = this.simulation.updateCourierFlight(transit.entityId, {
381 x: advanced.x,
382 y: advanced.y,
383 targetX: transit.destX,
384 targetY: transit.destY,
385 speed: advanced.speed,
386 lastAt: now,
387 courierId: transit.courierId
388 }, now);
389 if (moved?.despawned)
390 {
391 transit.entityId = null;
392 events.push({ type: "entity-despawn", entityId: moved.entityId, tileX, tileY });
393 }
394 else if (moved?.event)
395 { events.push(moved.event); }
396 return events;
397 }
398
399 #deliver (transit, now)
400 {
401 const events = [];
402 if (transit.entityId)
403 {
404 this.simulation.despawnEntity(transit.entityId);
405 events.push({
406 type: "entity-despawn",
407 entityId: transit.entityId,
408 tileX: Math.floor(transit.destX),
409 tileY: Math.floor(transit.destY)
410 });
411 transit.entityId = null;
412 }
413
414 if (transit.destinationKind === "bank")
415 {
416 const vaultCharacterId = transit.vaultCharacterId
417 ?? transit.destinationCharacterId
418 ?? transit.senderCharacterId;
419 const toast = this.#creditVault(vaultCharacterId, transit.cargo, {
420 senderCharacterId: transit.senderCharacterId
421 });
422 if (toast)
423 { events.push(toast); }
424 }
425 else if (transit.destinationKind === "player")
426 {
427 const delivered = this.#tryDeliverToPlayer(transit.destinationCharacterId, transit.cargo);
428 if (!delivered)
429 {
430 const bank = this.nearestBank(Math.floor(transit.destX), Math.floor(transit.destY))
431 ?? this.nearestBank(Math.floor(transit.originX), Math.floor(transit.originY));
432 if (bank)
433 {
434 transit.originX = transit.destX;
435 transit.originY = transit.destY;
436 transit.destX = bank.tileX + 0.5;
437 transit.destY = bank.tileY + 0.5;
438 transit.traveled = 0;
439 transit.destinationKind = "bank";
440 transit.vaultCharacterId = transit.destinationCharacterId;
441 transit.updatedAt = now;
442 this.stateDb.updateCourierTransit(transit);
443 events.push({
444 type: "pigeon-reroute-bank",
445 courierId: transit.courierId,
446 characterId: transit.destinationCharacterId
447 });
448 return events;
449 }
450 const toast = this.#creditVault(transit.destinationCharacterId, transit.cargo, {
451 senderCharacterId: transit.senderCharacterId
452 });
453 if (toast)
454 { events.push(toast); }
455 }
456 }
457
458 transit.status = "delivered";
459 transit.traveled = Math.hypot(transit.destX - transit.originX, transit.destY - transit.originY);
460 transit.updatedAt = now;
461 this.stateDb.updateCourierTransit(transit);
462 events.push({
463 type: "pigeon-delivered",
464 courierId: transit.courierId,
465 senderCharacterId: transit.senderCharacterId,
466 destinationKind: transit.destinationKind,
467 destinationCharacterId: transit.destinationCharacterId,
468 cargo: transit.cargo
469 });
470 return events;
471 }
472
473 #normalizeCargo (cargo)
474 {
475 if (cargo?.kind === "money")
476 {
477 return {
478 kind: "item",
479 stack: { itemId: ItemId.coins, quantity: Math.max(0, cargo.amount | 0) }
480 };
481 }
482 return cargo;
483 }
484
485 #tryDeliverToPlayer (characterId, cargo)
486 {
487 cargo = this.#normalizeCargo(cargo);
488 const onlineId = this.simulation.characterEntities.get(characterId);
489 if (!onlineId)
490 { return false; }
491 if (cargo.kind === "item")
492 {
493 const bag = this.simulation.bagOf(onlineId);
494 if (!bag)
495 { return false; }
496 const def = itemDefinition(cargo.stack.itemId);
497 const result = insertStack(bag.inventory, cargo.stack, def);
498 if (!result.ok || result.remainder)
499 { return false; }
500 bag.inventory = result.slots;
501 this.#persistBag(characterId, bag);
502 return true;
503 }
504 return false;
505 }
506
507 #creditVault (characterId, cargo, { senderCharacterId = null, recordRestNotice = true } = {})
508 {
509 cargo = this.#normalizeCargo(cargo);
510 const onlineId = this.simulation.characterEntities.get(characterId);
511 const bag = onlineId
512 ? this.simulation.bagOf(onlineId)
513 : this.stateDb.getBag(characterId);
514 if (!bag)
515 { return null; }
516 if (cargo.kind !== "item")
517 { return null; }
518
519 const stack = cargo.stack;
520 const isCeLetter = stack?.itemId === ItemId.letter && isCentralExchangeLetter(stack.instance);
521 const isRestNoticeLetter = stack?.itemId === ItemId.letter && isBankRestNoticeLetter(stack.instance);
522
523 if (stack?.itemId === ItemId.filledCheque && stack.instance?.kind === "filled-cheque")
524 {
525 this.#redeemChequeIntoVault(characterId, bag, stack);
526 this.#maybeRecordRestNotice({
527 characterId,
528 stack,
529 senderCharacterId,
530 recordRestNotice: recordRestNotice && !onlineId && !isCeLetter && !isRestNoticeLetter
531 });
532 return null;
533 }
534
535 const def = itemDefinition(stack.itemId);
536 const vault = normalizeVault(
537 bag.vaultReserved != null
538 ? { slots: bag.vault, reserved: bag.vaultReserved }
539 : bag.vault
540 );
541 const result = insertStackGrowable(vault.slots, stack, def);
542 bag.vault = result.slots;
543 bag.vaultReserved = vault.reserved;
544 this.#persistBag(characterId, bag);
545
546 this.#maybeRecordRestNotice({
547 characterId,
548 stack,
549 senderCharacterId,
550 recordRestNotice: recordRestNotice && !onlineId && !isCeLetter && !isRestNoticeLetter
551 });
552
553 if (onlineId && isRestNoticeLetter)
554 {
555 return {
556 type: "toast",
557 characterId,
558 message: "A letter arrived for you at the bank."
559 };
560 }
561 return null;
562 }
563
564 #maybeRecordRestNotice ({ characterId, stack, senderCharacterId, recordRestNotice })
565 {
566 if (!recordRestNotice || !stack)
567 { return; }
568 const sender = senderCharacterId ? this.stateDb.getCharacter(senderCharacterId) : null;
569 const senderDisplayName = sender
570 ? `${sender.first_name} ${sender.last_name}`.trim()
571 : null;
572 this.stateDb.appendBankRestNotice(characterId, {
573 itemId: stack.itemId,
574 itemName: itemNameForNotice(stack),
575 quantity: stack.quantity | 0 || 1,
576 sourceName: sourceNameForVaultDeposit(stack, senderCharacterId, senderDisplayName)
577 });
578 }
579
580 /** Pigeon/bank delivery of a filled cheque deposits the reserved goods, not the paper. */
581 #redeemChequeIntoVault (characterId, bag, chequeStack)
582 {
583 const instance = chequeStack.instance;
584 const issuerId = instance.issuerCharacterId;
585 const goodsDef = itemDefinition(instance.itemId);
586 if (!goodsDef)
587 { return; }
588
589 let reservedStack = null;
590 if (Number(issuerId) === Number(characterId))
591 {
592 const reserved = [...(bag.vaultReserved ?? [])];
593 const index = findReservedChequeIndex(reserved, instance);
594 if (index < 0)
595 {
596 // Paper arrived but reservation is gone — keep the cheque so it isn't silently lost.
597 const def = itemDefinition(ItemId.filledCheque);
598 const vault = normalizeVault({ slots: bag.vault, reserved: bag.vaultReserved });
599 const result = insertStackGrowable(vault.slots, chequeStack, def);
600 bag.vault = result.slots;
601 bag.vaultReserved = vault.reserved;
602 this.#persistBag(characterId, bag);
603 return;
604 }
605 reservedStack = reserved[index];
606 reserved.splice(index, 1);
607 bag.vaultReserved = reserved;
608 }
609 else
610 {
611 const release = this.simulation.releaseChequeReservation(issuerId, instance.chequeId, instance);
612 if (!release?.ok)
613 {
614 const def = itemDefinition(ItemId.filledCheque);
615 const vault = normalizeVault({ slots: bag.vault, reserved: bag.vaultReserved });
616 const result = insertStackGrowable(vault.slots, chequeStack, def);
617 bag.vault = result.slots;
618 bag.vaultReserved = vault.reserved;
619 this.#persistBag(characterId, bag);
620 return;
621 }
622 reservedStack = release.stack;
623 }
624
625 const vault = normalizeVault({ slots: bag.vault, reserved: bag.vaultReserved });
626 const inserted = insertStackGrowable(vault.slots, {
627 itemId: reservedStack.itemId,
628 quantity: reservedStack.quantity,
629 origin: reservedStack.origin ?? null,
630 origins: reservedStack.origins ?? null,
631 instance: reservedStack.instance ?? null
632 }, goodsDef);
633 bag.vault = inserted.slots;
634 bag.vaultReserved = vault.reserved;
635 this.#persistBag(characterId, bag);
636 this.#maybeRecordRestNotice({
637 characterId,
638 stack: {
639 itemId: reservedStack.itemId,
640 quantity: reservedStack.quantity,
641 origin: reservedStack.origin ?? null,
642 origins: reservedStack.origins ?? null,
643 instance: reservedStack.instance ?? null
644 },
645 senderCharacterId: null,
646 recordRestNotice: !this.simulation.characterEntities.get(characterId)
647 });
648 }
649
650 #persistBag (characterId, bag)
651 {
652 this.stateDb.saveBag(characterId, bag);
653 const onlineId = this.simulation.characterEntities.get(characterId);
654 if (onlineId)
655 {
656 this.simulation.applyBag(onlineId, bag);
657 this.simulation.pushInventory(characterId, bag);
658 }
659 }
660
661 #characterDisplayName (characterId)
662 {
663 const row = this.stateDb.getCharacter(characterId);
664 return {
665 firstName: row?.first_name ?? "Unknown",
666 lastName: row?.last_name ?? "",
667 full: row ? `${row.first_name} ${row.last_name}`.trim() : "Adventurer"
668 };
669 }
670
671 #dispatchBankRestNotice (characterId, tileX, tileY)
672 {
673 const entries = this.stateDb.listBankRestNotices(characterId);
674 if (!entries.length)
675 { return null; }
676 const bank = this.nearestBank(tileX, tileY);
677 if (!bank)
678 { return null; }
679
680 const lines = mergeBankRestNoticeLines(entries.map((entry) => ({
681 quantity: entry.quantity,
682 itemName: entry.itemName,
683 sourceName: entry.sourceName
684 })));
685 const { full: playerName } = this.#characterDisplayName(characterId);
686 const body = bankRestNoticeLetterBody({ playerName, lines });
687 const stack = {
688 itemId: ItemId.letter,
689 quantity: 1,
690 instance: {
691 kind: "letter",
692 letterId: randomUUID(),
693 authorCharacterId: 0,
694 authorDisplayName: BANK_LETTER_AUTHOR,
695 body,
696 opened: false,
697 writtenAt: Date.now(),
698 bankRestNotice: true
699 }
700 };
701 this.stateDb.clearBankRestNotices(characterId);
702 return this.stateDb.insertCourierTransit({
703 senderCharacterId: characterId,
704 destinationKind: "player",
705 destinationCharacterId: characterId,
706 vaultCharacterId: characterId,
707 cargo: { kind: "item", stack },
708 originX: bank.tileX + 0.5,
709 originY: bank.tileY + 0.5,
710 destX: tileX + 0.5,
711 destY: tileY + 0.5,
712 traveled: 0,
713 status: "in_transit",
714 entityId: null
715 });
716 }
717}