BlueGit

timfa questward

Files

questward / client / src / editor / conditionSetEditor.js

conditionSetEditor.js

conditionSetEditor.js 21.7 KiB Download Raw
1import { ConditionKind, emptyConditionSet, normalizeConditionSet } from "/shared/quests/conditions.js";
2import { itemDefinition, listAllItemPickerEntries } from "/shared/definitions/items.js";
3import { listSpawnableMobTypes } from "/shared/definitions/mobs.js";
4import { createDimensionCombobox } from "./dimensionCombobox.js";
5import { OVERWORLD_ID } from "/shared/world/dimensions.js";
6
7/** All condition kinds available in the shared editor UI. */
8export const CONDITION_EDITOR_KINDS = Object.freeze(Object.values(ConditionKind));
9
10export { emptyConditionSet, normalizeConditionSet, ConditionKind };
11
12export function renderConditionSet (when, onChange, ctx = {})
13{
14 const wrap = document.createElement("div");
15 const set = normalizeConditionSet(when);
16 const bump = (remount = true) => onChange(set, { remount });
17 const questList = Array.isArray(ctx.quests) ? ctx.quests : [];
18 const dialogueList = Array.isArray(ctx.dialogues) ? ctx.dialogues : [];
19 const title = document.createElement("strong");
20 title.textContent = "When (all of)";
21 wrap.append(title);
22
23 set.all.forEach((clause, index) =>
24 {
25 const row = document.createElement("div");
26 row.className = "content-editor-clause";
27 const notLabel = document.createElement("label");
28 const notBox = document.createElement("input");
29 notBox.type = "checkbox";
30 notBox.checked = !!clause.not;
31 notBox.addEventListener("change", () =>
32 {
33 set.all[index].not = notBox.checked;
34 bump(false);
35 });
36 notLabel.append(notBox, document.createTextNode(" NOT"));
37 row.append(notLabel);
38
39 const kind = document.createElement("select");
40 for (const k of CONDITION_EDITOR_KINDS)
41 {
42 const opt = document.createElement("option");
43 opt.value = k;
44 opt.textContent = k;
45 if ((clause.condition?.kind ?? "") === k)
46 { opt.selected = true; }
47 kind.append(opt);
48 }
49 const otherOpt = document.createElement("option");
50 otherOpt.value = "__other__";
51 otherOpt.textContent = "(other / JSON)";
52 if (!CONDITION_EDITOR_KINDS.includes(clause.condition?.kind))
53 { otherOpt.selected = true; }
54 kind.append(otherOpt);
55 kind.addEventListener("change", () =>
56 {
57 if (kind.value === "__other__")
58 { return; }
59 set.all[index].condition = defaultCondition(kind.value);
60 bump(true);
61 });
62 row.append(kind);
63
64 const cond = clause.condition ?? { kind: ConditionKind.hasItem };
65 if (cond.kind === ConditionKind.hasItem)
66 {
67 row.append(itemConditionPicker(cond, () =>
68 {
69 set.all[index].condition = cond;
70 bump(false);
71 }));
72 row.append(miniField("qty", cond.quantity ?? 1, (v) =>
73 {
74 cond.quantity = Number(v) || 1;
75 set.all[index].condition = cond;
76 bump(false);
77 }));
78 }
79 else if (cond.kind === ConditionKind.questState)
80 {
81 row.append(questStateConditionFields(cond, questList, () =>
82 {
83 set.all[index].condition = cond;
84 bump(false);
85 }));
86 }
87 else if (cond.kind === ConditionKind.dialogueHeard)
88 {
89 row.append(dialogueHeardConditionFields(cond, dialogueList, () =>
90 {
91 set.all[index].condition = cond;
92 bump(false);
93 }));
94 }
95 else if (cond.kind === ConditionKind.killCount)
96 {
97 row.append(killCountConditionFields(cond, () =>
98 {
99 set.all[index].condition = cond;
100 bump(false);
101 }));
102 }
103 else if (cond.kind === ConditionKind.atTile)
104 {
105 row.append(atTileConditionFields(cond, ctx, () =>
106 {
107 set.all[index].condition = cond;
108 bump(false);
109 }));
110 }
111 else if (
112 cond.kind === ConditionKind.inDimension
113 || cond.kind === ConditionKind.hasVisitedDimension
114 )
115 {
116 row.append(dimensionConditionField(cond, ctx, () =>
117 {
118 set.all[index].condition = cond;
119 bump(false);
120 }));
121 }
122 else if (cond.kind === ConditionKind.nearTile)
123 {
124 row.append(atTileConditionFields(cond, ctx, () =>
125 {
126 set.all[index].condition = cond;
127 bump(false);
128 }));
129 row.append(miniField("range", cond.range ?? 1, (v) =>
130 {
131 cond.range = Math.max(1, Number(v) || 1);
132 set.all[index].condition = cond;
133 bump(false);
134 }));
135 }
136 else if (cond.kind === ConditionKind.inRect)
137 {
138 row.append(dimensionConditionField(cond, ctx, () =>
139 {
140 set.all[index].condition = cond;
141 bump(false);
142 }));
143 for (const key of ["minTileX", "minTileY", "maxTileX", "maxTileY"])
144 {
145 row.append(miniField(key, cond[key] ?? 0, (v) =>
146 {
147 cond[key] = Number(v) | 0;
148 set.all[index].condition = cond;
149 bump(false);
150 }));
151 }
152 }
153 else if (cond.kind === ConditionKind.atChunk)
154 {
155 row.append(dimensionConditionField(cond, ctx, () =>
156 {
157 set.all[index].condition = cond;
158 bump(false);
159 }));
160 row.append(miniField("chunkX", cond.chunkX ?? 0, (v) =>
161 {
162 cond.chunkX = Number(v) | 0;
163 set.all[index].condition = cond;
164 bump(false);
165 }));
166 row.append(miniField("chunkY", cond.chunkY ?? 0, (v) =>
167 {
168 cond.chunkY = Number(v) | 0;
169 set.all[index].condition = cond;
170 bump(false);
171 }));
172 }
173 else if (cond.kind === ConditionKind.questStepAtLeast)
174 {
175 row.append(miniField("questId", cond.questId ?? "", (v) =>
176 {
177 cond.questId = v;
178 set.all[index].condition = cond;
179 bump(false);
180 }));
181 row.append(miniField("step", cond.step ?? 1, (v) =>
182 {
183 cond.step = Math.max(1, Number(v) || 1);
184 set.all[index].condition = cond;
185 bump(false);
186 }));
187 }
188 else if (cond.kind === ConditionKind.dialogueTrigger)
189 {
190 row.append(miniField("dialogueId", cond.dialogueId ?? "", (v) =>
191 {
192 cond.dialogueId = v;
193 set.all[index].condition = cond;
194 bump(false);
195 }));
196 row.append(miniField("trigger", cond.trigger ?? "", (v) =>
197 {
198 cond.trigger = v;
199 set.all[index].condition = cond;
200 bump(false);
201 }));
202 }
203 else if (
204 cond.kind === ConditionKind.hpAtLeast
205 || cond.kind === ConditionKind.staminaAtLeast
206 )
207 {
208 row.append(miniField("amount", cond.amount ?? 1, (v) =>
209 {
210 cond.amount = Math.max(0, Number(v) || 0);
211 set.all[index].condition = cond;
212 bump(false);
213 }));
214 }
215 else if (
216 cond.kind === ConditionKind.hpPercentAtLeast
217 || cond.kind === ConditionKind.staminaPercentAtLeast
218 )
219 {
220 row.append(miniField("percent", cond.percent ?? 50, (v) =>
221 {
222 cond.percent = Math.min(100, Math.max(0, Number(v) || 0));
223 set.all[index].condition = cond;
224 bump(false);
225 }));
226 }
227 else if (cond.kind === ConditionKind.skillLevelAtLeast)
228 {
229 row.append(miniField("skillId", cond.skillId ?? "", (v) =>
230 {
231 cond.skillId = v;
232 set.all[index].condition = cond;
233 bump(false);
234 }));
235 row.append(miniField("level", cond.level ?? 1, (v) =>
236 {
237 cond.level = Math.max(1, Math.min(99, Number(v) || 1));
238 set.all[index].condition = cond;
239 bump(false);
240 }));
241 }
242 else if (cond.kind === ConditionKind.interactBlock)
243 {
244 row.append(atTileConditionFields(cond, ctx, () =>
245 {
246 set.all[index].condition = cond;
247 bump(false);
248 }));
249 row.append(miniField("blockTypeId", cond.blockTypeId ?? "", (v) =>
250 {
251 cond.blockTypeId = v === "" ? undefined : (Number(v) || v);
252 set.all[index].condition = cond;
253 bump(false);
254 }));
255 }
256 else
257 {
258 const json = document.createElement("textarea");
259 json.rows = 3;
260 json.value = JSON.stringify(cond, null, 2);
261 json.addEventListener("change", () =>
262 {
263 try
264 {
265 set.all[index].condition = JSON.parse(json.value);
266 bump(false);
267 }
268 catch
269 { /* keep typing */ }
270 });
271 row.append(json);
272 }
273
274 const remove = document.createElement("button");
275 remove.type = "button";
276 remove.textContent = "×";
277 remove.addEventListener("click", () =>
278 {
279 set.all.splice(index, 1);
280 bump(true);
281 });
282 row.append(remove);
283 wrap.append(row);
284 });
285
286 const add = document.createElement("button");
287 add.type = "button";
288 add.textContent = "Add clause";
289 add.addEventListener("click", () =>
290 {
291 set.all.push({ not: false, condition: defaultCondition(ConditionKind.hasItem) });
292 bump(true);
293 });
294 wrap.append(add);
295
296 const jsonFallback = document.createElement("details");
297 const summary = document.createElement("summary");
298 summary.textContent = "Edit condition set as JSON";
299 const area = document.createElement("textarea");
300 area.rows = 5;
301 area.value = JSON.stringify(set, null, 2);
302 area.addEventListener("change", () =>
303 {
304 try
305 {
306 onChange(normalizeConditionSet(JSON.parse(area.value)), { remount: true });
307 }
308 catch
309 { /* ignore */ }
310 });
311 jsonFallback.append(summary, area);
312 wrap.append(jsonFallback);
313 return wrap;
314}
315
316/** X/Y inputs, tile summary, and center-editor control for atTile. */
317function atTileConditionFields (cond, ctx, onChanged)
318{
319 const wrap = document.createElement("div");
320 wrap.className = "quest-condition-attile";
321 const dimField = dimensionConditionField(cond, ctx, () =>
322 {
323 refreshInfo();
324 onChanged();
325 });
326 const xInput = document.createElement("input");
327 xInput.type = "number";
328 xInput.step = "1";
329 xInput.style.width = "5rem";
330 xInput.value = String(cond.tileX ?? 0);
331 xInput.title = "Tile X";
332 const yInput = document.createElement("input");
333 yInput.type = "number";
334 yInput.step = "1";
335 yInput.style.width = "5rem";
336 yInput.value = String(cond.tileY ?? 0);
337 yInput.title = "Tile Y";
338 const xyRow = document.createElement("div");
339 xyRow.className = "quest-condition-pair";
340 const xLabel = document.createElement("label");
341 xLabel.append(document.createTextNode("X "), xInput);
342 const yLabel = document.createElement("label");
343 yLabel.append(document.createTextNode("Y "), yInput);
344 const centerBtn = document.createElement("button");
345 centerBtn.type = "button";
346 centerBtn.textContent = "Center editor";
347 centerBtn.title = "Pan the world editor to this tile (keeps this UI open)";
348 const info = document.createElement("pre");
349 info.className = "quest-condition-tile-info";
350
351 const refreshInfo = () =>
352 {
353 if (typeof ctx.describeWorldTile === "function")
354 {
355 info.textContent = ctx.describeWorldTile(
356 cond.tileX | 0,
357 cond.tileY | 0,
358 cond.dimensionId
359 );
360 }
361 else
362 { info.textContent = "Tile inspection unavailable."; }
363 };
364
365 xInput.addEventListener("input", () =>
366 {
367 cond.tileX = Number(xInput.value) | 0;
368 refreshInfo();
369 onChanged();
370 });
371 yInput.addEventListener("input", () =>
372 {
373 cond.tileY = Number(yInput.value) | 0;
374 refreshInfo();
375 onChanged();
376 });
377 centerBtn.addEventListener("click", () =>
378 {
379 ctx.centerEditorOnTile?.(cond.tileX | 0, cond.tileY | 0, cond.dimensionId);
380 refreshInfo();
381 });
382
383 xyRow.append(xLabel, yLabel, centerBtn);
384 wrap.append(dimField, xyRow, info);
385 refreshInfo();
386 return wrap;
387}
388
389/** Searchable dimension combobox bound to condition.dimensionId. */
390function dimensionConditionField (cond, ctx, onChanged)
391{
392 const root = document.createElement("div");
393 root.className = "quest-condition-dim";
394 const combo = createDimensionCombobox({
395 root,
396 allowCreate: false,
397 placeholder: "Dimension…",
398 onSelect (id)
399 {
400 cond.dimensionId = id || OVERWORLD_ID;
401 onChanged();
402 }
403 });
404 const options = typeof ctx.getDimensionOptions === "function"
405 ? ctx.getDimensionOptions()
406 : [{ id: OVERWORLD_ID, label: "Overworld" }];
407 combo.setOptions(options);
408 combo.setValue(cond.dimensionId || OVERWORLD_ID);
409 return root;
410}
411
412/** Mob selector + kill quantity for killCount conditions. */
413function killCountConditionFields (cond, onChanged)
414{
415 const wrap = document.createElement("div");
416 wrap.className = "quest-condition-pair";
417 const mobSelect = document.createElement("select");
418 for (const def of listSpawnableMobTypes())
419 {
420 const opt = document.createElement("option");
421 opt.value = def.mobTypeId;
422 opt.textContent = def.displayName ?? def.mobTypeId;
423 if (def.mobTypeId === cond.mobTypeId)
424 { opt.selected = true; }
425 mobSelect.append(opt);
426 }
427 if (cond.mobTypeId && ![...mobSelect.options].some((o) => o.value === cond.mobTypeId))
428 {
429 const missing = document.createElement("option");
430 missing.value = cond.mobTypeId;
431 missing.textContent = `${cond.mobTypeId} (missing)`;
432 missing.selected = true;
433 mobSelect.append(missing);
434 }
435 if (!cond.mobTypeId && mobSelect.options.length)
436 {
437 cond.mobTypeId = mobSelect.options[0].value;
438 mobSelect.options[0].selected = true;
439 }
440 const qty = document.createElement("input");
441 qty.type = "number";
442 qty.min = "1";
443 qty.step = "1";
444 qty.style.width = "5rem";
445 qty.value = String(Math.max(1, Number(cond.count) || 1));
446 qty.title = "Kill count";
447 mobSelect.addEventListener("change", () =>
448 {
449 cond.mobTypeId = mobSelect.value || undefined;
450 onChanged();
451 });
452 qty.addEventListener("input", () =>
453 {
454 cond.count = Math.max(1, Number(qty.value) || 1);
455 onChanged();
456 });
457 wrap.append(mobSelect, qty);
458 return wrap;
459}
460
461/** Dialogue picker + step-id dropdown from that tree. */
462function dialogueHeardConditionFields (cond, dialogueList, onChanged)
463{
464 const wrap = document.createElement("div");
465 wrap.className = "quest-condition-pair";
466 const dialogueSelect = document.createElement("select");
467 const blank = document.createElement("option");
468 blank.value = "";
469 blank.textContent = "Select dialogue…";
470 dialogueSelect.append(blank);
471 for (const tree of dialogueList)
472 {
473 const opt = document.createElement("option");
474 opt.value = tree.dialogueId;
475 opt.textContent = tree.label ? `${tree.label} (${tree.dialogueId})` : tree.dialogueId;
476 if (tree.dialogueId === cond.dialogueId)
477 { opt.selected = true; }
478 dialogueSelect.append(opt);
479 }
480 if (cond.dialogueId && !dialogueList.some((d) => d.dialogueId === cond.dialogueId))
481 {
482 const missing = document.createElement("option");
483 missing.value = cond.dialogueId;
484 missing.textContent = `${cond.dialogueId} (missing)`;
485 missing.selected = true;
486 dialogueSelect.append(missing);
487 }
488
489 const stepSelect = document.createElement("select");
490 const fillSteps = () =>
491 {
492 const tree = dialogueList.find((d) => d.dialogueId === cond.dialogueId) ?? null;
493 stepSelect.replaceChildren();
494 const steps = tree?.steps ?? [];
495 if (!steps.length)
496 {
497 const empty = document.createElement("option");
498 empty.value = cond.stepId ?? "";
499 empty.textContent = cond.stepId ? String(cond.stepId) : "No steps";
500 empty.selected = true;
501 stepSelect.append(empty);
502 return;
503 }
504 let matched = false;
505 for (const step of steps)
506 {
507 const opt = document.createElement("option");
508 opt.value = step.stepId;
509 opt.textContent = step.label
510 ? `${step.label} (${step.stepId})`
511 : step.stepId;
512 if (step.stepId === cond.stepId)
513 {
514 opt.selected = true;
515 matched = true;
516 }
517 stepSelect.append(opt);
518 }
519 if (!matched && cond.stepId)
520 {
521 const fallback = document.createElement("option");
522 fallback.value = cond.stepId;
523 fallback.textContent = `${cond.stepId} (missing)`;
524 fallback.selected = true;
525 stepSelect.append(fallback);
526 }
527 else if (!matched)
528 {
529 cond.stepId = steps[0].stepId;
530 stepSelect.options[0].selected = true;
531 }
532 };
533 fillSteps();
534
535 dialogueSelect.addEventListener("change", () =>
536 {
537 cond.dialogueId = dialogueSelect.value;
538 const tree = dialogueList.find((d) => d.dialogueId === cond.dialogueId);
539 cond.stepId = tree?.steps?.[0]?.stepId ?? "";
540 fillSteps();
541 onChanged();
542 });
543 stepSelect.addEventListener("change", () =>
544 {
545 cond.stepId = stepSelect.value;
546 onChanged();
547 });
548 wrap.append(dialogueSelect, stepSelect);
549 return wrap;
550}
551
552/** Quest picker + state dropdown from that quest's steps. */
553function questStateConditionFields (cond, questList, onChanged)
554{
555 const wrap = document.createElement("div");
556 wrap.className = "quest-condition-pair";
557 const questSelect = document.createElement("select");
558 const blank = document.createElement("option");
559 blank.value = "";
560 blank.textContent = "Select quest…";
561 questSelect.append(blank);
562 for (const quest of questList)
563 {
564 const opt = document.createElement("option");
565 opt.value = quest.questId;
566 opt.textContent = quest.title ? `${quest.title} (${quest.questId})` : quest.questId;
567 if (quest.questId === cond.questId)
568 { opt.selected = true; }
569 questSelect.append(opt);
570 }
571 if (cond.questId && !questList.some((q) => q.questId === cond.questId))
572 {
573 const missing = document.createElement("option");
574 missing.value = cond.questId;
575 missing.textContent = `${cond.questId} (missing)`;
576 missing.selected = true;
577 questSelect.append(missing);
578 }
579
580 const stateSelect = document.createElement("select");
581 const fillStates = () =>
582 {
583 const quest = questList.find((q) => q.questId === cond.questId) ?? null;
584 stateSelect.replaceChildren();
585 const options = [
586 { value: "not-started", label: "not-started" },
587 ...((quest?.steps ?? []).map((step, index) => ({
588 value: String(index + 1),
589 label: `Step ${index + 1}: ${step.title || step.stepId}`
590 }))),
591 { value: "completed", label: "completed" }
592 ];
593 let matched = false;
594 for (const entry of options)
595 {
596 const opt = document.createElement("option");
597 opt.value = entry.value;
598 opt.textContent = entry.label;
599 const current = cond.state ?? "not-started";
600 const currentKey = current === "not-started" || current === "completed"
601 ? current
602 : String(Number(current) || current);
603 if (entry.value === currentKey)
604 {
605 opt.selected = true;
606 matched = true;
607 }
608 stateSelect.append(opt);
609 }
610 if (!matched)
611 {
612 const fallback = document.createElement("option");
613 fallback.value = String(cond.state ?? "not-started");
614 fallback.textContent = String(cond.state ?? "not-started");
615 fallback.selected = true;
616 stateSelect.append(fallback);
617 }
618 };
619 fillStates();
620
621 questSelect.addEventListener("change", () =>
622 {
623 cond.questId = questSelect.value;
624 cond.state = "not-started";
625 fillStates();
626 onChanged();
627 });
628 stateSelect.addEventListener("change", () =>
629 {
630 const raw = stateSelect.value;
631 if (raw === "not-started" || raw === "completed")
632 { cond.state = raw; }
633 else
634 { cond.state = Math.max(1, Number(raw) | 0); }
635 onChanged();
636 });
637 wrap.append(questSelect, stateSelect);
638 return wrap;
639}
640
641/** Compact searchable item picker for hasItem conditions. */
642function itemConditionPicker (cond, onPicked)
643{
644 const wrap = document.createElement("div");
645 wrap.className = "quest-condition-item-picker";
646 const pickBtn = document.createElement("button");
647 pickBtn.type = "button";
648 const refreshLabel = () =>
649 {
650 const def = itemDefinition(cond.itemId);
651 pickBtn.textContent = def?.displayName
652 ?? (cond.itemId ? `Item #${cond.itemId}` : "Pick item…");
653 pickBtn.title = cond.itemId
654 ? `${def?.key ?? "item"} · #${cond.itemId}`
655 : "Choose an item";
656 };
657 refreshLabel();
658 const searchWrap = document.createElement("div");
659 searchWrap.className = "dialogue-reward-item-search";
660 searchWrap.hidden = true;
661 const searchInput = document.createElement("input");
662 searchInput.type = "search";
663 searchInput.placeholder = "Search items…";
664 searchInput.autocomplete = "off";
665 const searchResults = document.createElement("div");
666 searchResults.className = "dialogue-reward-item-results";
667
668 const renderMatches = (query) =>
669 {
670 searchResults.replaceChildren();
671 const q = String(query ?? "").trim().toLowerCase();
672 const matches = listAllItemPickerEntries().filter((item) =>
673 {
674 if (!q)
675 { return true; }
676 return item.displayName.toLowerCase().includes(q)
677 || item.key.toLowerCase().includes(q)
678 || String(item.itemId).includes(q);
679 }).slice(0, 40);
680 if (!matches.length)
681 {
682 searchResults.textContent = "No matching items.";
683 return;
684 }
685 for (const item of matches)
686 {
687 const row = document.createElement("button");
688 row.type = "button";
689 row.className = "shop-item-search-row";
690 const name = document.createElement("span");
691 name.className = "shop-item-search-row-name";
692 name.textContent = item.displayName;
693 const key = document.createElement("span");
694 key.className = "shop-item-search-row-key";
695 key.textContent = `${item.key} · #${item.itemId}`;
696 row.append(name, key);
697 row.addEventListener("click", () =>
698 {
699 cond.itemId = item.itemId;
700 refreshLabel();
701 searchWrap.hidden = true;
702 onPicked();
703 });
704 searchResults.append(row);
705 }
706 };
707
708 pickBtn.addEventListener("click", () =>
709 {
710 searchWrap.hidden = !searchWrap.hidden;
711 if (!searchWrap.hidden)
712 {
713 searchInput.value = "";
714 renderMatches("");
715 searchInput.focus();
716 }
717 });
718 searchInput.addEventListener("input", () => renderMatches(searchInput.value));
719 searchWrap.append(searchInput, searchResults);
720 wrap.append(pickBtn, searchWrap);
721 return wrap;
722}
723
724function miniField (label, value, onChange)
725{
726 const wrap = document.createElement("label");
727 wrap.textContent = `${label} `;
728 const input = document.createElement("input");
729 input.type = "text";
730 input.value = String(value ?? "");
731 input.style.width = "7rem";
732 input.addEventListener("input", () => onChange(input.value));
733 wrap.append(input);
734 return wrap;
735}
736
737function defaultCondition (kind)
738{
739 switch (kind)
740 {
741 case ConditionKind.hasItem:
742 return { kind, itemId: 1, quantity: 1 };
743 case ConditionKind.questState:
744 return { kind, questId: "", state: "not-started" };
745 case ConditionKind.dialogueHeard:
746 return { kind, dialogueId: "", stepId: "" };
747 case ConditionKind.dialogueTrigger:
748 return { kind, dialogueId: "", trigger: "" };
749 case ConditionKind.killCount:
750 return { kind, mobTypeId: "deer", count: 1 };
751 case ConditionKind.atTile:
752 case ConditionKind.nearTile:
753 return { kind, dimensionId: OVERWORLD_ID, tileX: 0, tileY: 0, ...(kind === ConditionKind.nearTile ? { range: 1 } : {}) };
754 case ConditionKind.inRect:
755 return { kind, dimensionId: OVERWORLD_ID, minTileX: 0, minTileY: 0, maxTileX: 0, maxTileY: 0 };
756 case ConditionKind.atChunk:
757 return { kind, dimensionId: OVERWORLD_ID, chunkX: 0, chunkY: 0 };
758 case ConditionKind.inDimension:
759 case ConditionKind.hasVisitedDimension:
760 return { kind, dimensionId: OVERWORLD_ID };
761 case ConditionKind.questStepAtLeast:
762 return { kind, questId: "", step: 1 };
763 case ConditionKind.hpAtLeast:
764 case ConditionKind.staminaAtLeast:
765 return { kind, amount: 1 };
766 case ConditionKind.hpPercentAtLeast:
767 case ConditionKind.staminaPercentAtLeast:
768 return { kind, percent: 50 };
769 case ConditionKind.skillLevelAtLeast:
770 return { kind, skillId: "attack", level: 1 };
771 case ConditionKind.interactBlock:
772 return { kind, dimensionId: OVERWORLD_ID, tileX: 0, tileY: 0 };
773 default:
774 return { kind };
775 }
776}