Added editor pages for plants and mutations.

This commit is contained in:
sarah committed 2026-09-01 20:23:16 +02:00
1 parent 953df07878
commit c2a78b18b4
6 files changed
+4288 -2

No files matched your search

+24 -2
View File
@@ -30,9 +30,31 @@ $PageSection = "Admin";
hidden
>
<p>
Admin access verified. Garden content
editors will live here.
Content tools for editing the Garden catalogue.
Changes here affect the live game data.
</p>
<div class="AdminEditorNavigation">
<a
class="ActionButton AdminEditorLink"
href="/Pages/AdminPlants.html"
>
<strong>Plant editor</strong>
<span>
Add plants and edit their catalogue data.
</span>
</a>
<a
class="ActionButton AdminEditorLink"
href="/Pages/AdminMutations.html"
>
<strong>Mutation editor</strong>
<span>
Build mutation recipes with a visual grid.
</span>
</a>
</div>
</div>
</main>
</body>
+432
View File
@@ -0,0 +1,432 @@
<?php
$PageTitle = "Admin mutations";
$PageSection = "Admin";
?>
<!DOCTYPE html>
<html lang="en" data-palette="CatppuccinMocha">
<?php require __DIR__ . "/Bits/Head.php"; ?>
<body>
<?php require __DIR__ . "/Bits/Navbar.php"; ?>
<main class="MainContainer AdminMutationMain">
<h1>Mutation editor</h1>
<p>
Edit mutation settings and build the recipe visually.
Select a cell in either grid to change what it means.
</p>
<p
id="AdminAccessMessage"
class="PageMessage"
aria-live="polite"
>
Checking admin access...
</p>
<div
id="AdminContent"
hidden
>
<div class="AdminEditorToolbar">
<label for="AdminMutationSelect">
Mutation
</label>
<select id="AdminMutationSelect"></select>
<button
id="AdminMutationNewButton"
class="ActionButton AdminInlineButton"
type="button"
>
New mutation
</button>
</div>
<form
id="AdminMutationForm"
class="Panel AdminEditorForm"
>
<div class="AdminEditorGrid">
<label class="AdminEditorField">
<span>ID</span>
<input
id="AdminMutationId"
type="number"
min="1"
step="1"
required
>
<small>
Permanent. New mutations default to the next ID.
</small>
</label>
<label class="AdminEditorField">
<span>Mutation Key</span>
<input
id="AdminMutationKey"
type="text"
maxlength="64"
required
>
</label>
<label class="AdminEditorField AdminEditorWideField">
<span>Name</span>
<input
id="AdminMutationName"
type="text"
maxlength="128"
required
>
</label>
<label class="AdminEditorField AdminEditorWideField">
<span>Description</span>
<textarea
id="AdminMutationDescription"
rows="4"
required
></textarea>
</label>
<label class="AdminEditorField">
<span>Priority</span>
<input
id="AdminMutationPriority"
type="number"
step="1"
required
>
</label>
<label class="AdminEditorField">
<span>Chance (%)</span>
<input
id="AdminMutationChance"
type="number"
min="0"
max="100"
step="0.01"
required
>
</label>
<label class="AdminEditorField">
<span>Cooldown (ms)</span>
<input
id="AdminMutationCooldown"
type="number"
min="0"
step="1000"
required
>
<small id="AdminMutationCooldownHint"></small>
</label>
<label class="AdminEditorField">
<span>Rotation</span>
<select id="AdminMutationRotation">
<option value="None">None</option>
<option value="Any">Any</option>
</select>
</label>
<label class="AdminEditorCheckField">
<input
id="AdminMutationAllowImmature"
type="checkbox"
>
<span>
Allow immature plants
</span>
</label>
</div>
<section class="AdminMutationRecipeSection">
<div class="AdminMutationRecipeHeader">
<div>
<h2>Visual recipe</h2>
<p>
Pattern and result always use the same dimensions.
</p>
</div>
<div class="AdminMutationDimensions">
<label>
Width
<input
id="AdminMutationWidth"
type="number"
min="1"
max="7"
step="1"
value="3"
>
</label>
<label>
Height
<input
id="AdminMutationHeight"
type="number"
min="1"
max="7"
step="1"
value="1"
>
</label>
<button
id="AdminMutationResizeButton"
class="ActionButton AdminInlineButton"
type="button"
>
Resize
</button>
</div>
</div>
<div class="AdminMutationRecipeFlow">
<div class="AdminMutationGridPanel">
<h3>Arrange</h3>
<div
id="AdminMutationPatternGrid"
class="GuideRecipe AdminMutationGrid"
></div>
</div>
<span
class="MutationEncyclopediaRecipeArrow"
aria-hidden="true"
>
→
</span>
<div class="AdminMutationGridPanel">
<h3>Result</h3>
<div
id="AdminMutationResultGrid"
class="GuideRecipe AdminMutationGrid"
></div>
</div>
</div>
<div
id="AdminMutationCellEditor"
class="AdminMutationCellEditor"
hidden
>
<h3 id="AdminMutationCellEditorTitle">
Cell
</h3>
<div id="AdminMutationPatternCellControls">
<label class="AdminEditorField">
<span>Type</span>
<select id="AdminMutationPatternCellType">
<option value="Any">Any</option>
<option value="Empty">Empty</option>
<option value="Plant">Exact plant</option>
<option value="Matcher">Tag matcher</option>
</select>
</label>
<label
id="AdminMutationPatternPlantRow"
class="AdminEditorField"
hidden
>
<span>Plant</span>
<select id="AdminMutationPatternPlant"></select>
</label>
<div
id="AdminMutationMatcherRows"
class="AdminMatcherFields"
hidden
>
<label class="AdminEditorField">
<span>Exact plant (optional)</span>
<select id="AdminMutationMatcherPlant"></select>
</label>
<label class="AdminEditorField">
<span>Required tags</span>
<input
id="AdminMutationMatcherTags"
type="text"
placeholder="Rose, Red"
>
</label>
<label class="AdminEditorField">
<span>Any of these tags</span>
<input
id="AdminMutationMatcherTagsAny"
type="text"
>
</label>
<label class="AdminEditorField">
<span>Excluded tags</span>
<input
id="AdminMutationMatcherTagsNot"
type="text"
>
</label>
<label class="AdminEditorField">
<span>Capture name</span>
<input
id="AdminMutationMatcherCapture"
type="text"
placeholder="ParentA"
>
</label>
</div>
</div>
<div
id="AdminMutationResultCellControls"
hidden
>
<label class="AdminEditorField">
<span>Type</span>
<select id="AdminMutationResultCellType">
<option value="Keep">Keep</option>
<option value="Empty">Empty</option>
<option value="Plant">Plant</option>
<option value="Capture">Captured plant</option>
</select>
</label>
<label
id="AdminMutationResultPlantRow"
class="AdminEditorField"
hidden
>
<span>Plant</span>
<select id="AdminMutationResultPlant"></select>
</label>
<label
id="AdminMutationResultCaptureRow"
class="AdminEditorField"
hidden
>
<span>Capture name</span>
<input
id="AdminMutationResultCapture"
type="text"
placeholder="ParentA"
>
</label>
</div>
</div>
</section>
<section class="AdminMutationRelationsSection">
<h2>Plant relationships</h2>
<p>
These power discoveries and encyclopedia links.
They are metadata, so tag-based recipes may still
need explicit plants selected here.
</p>
<div class="AdminMutationRelationColumns">
<fieldset>
<legend>Plants used</legend>
<div
id="AdminMutationPlantsUsed"
class="AdminPlantChecklist"
></div>
</fieldset>
<fieldset>
<legend>Plants created</legend>
<div
id="AdminMutationPlantsCreated"
class="AdminPlantChecklist"
></div>
</fieldset>
</div>
</section>
<section class="AdminMutationFailureSection">
<h2>Failure result</h2>
<label class="AdminEditorField">
<span>On failure</span>
<select id="AdminMutationFailureType">
<option value="Keep">Keep everything</option>
<option value="Clear">Clear matched area</option>
<option value="Custom">Custom result JSON</option>
</select>
</label>
<label
id="AdminMutationFailureJsonRow"
class="AdminEditorField"
hidden
>
<span>Custom failure result JSON</span>
<textarea
id="AdminMutationFailureJson"
rows="6"
spellcheck="false"
></textarea>
</label>
</section>
<details class="AdminGeneratedJson">
<summary>Generated mutation JSON</summary>
<pre id="AdminMutationJsonPreview"></pre>
</details>
<p id="AdminMutationArchiveNote" hidden>
This mutation is currently archived.
</p>
<div class="AdminEditorActions">
<button
id="AdminMutationSaveButton"
class="ActionButton AdminSaveButton"
type="submit"
>
Save mutation
</button>
<a
class="ActionButton AdminInlineButton AdminEditorBackLink"
href="/Pages/Admin.html"
>
Back to Admin
</a>
</div>
</form>
<p
id="AdminMutationMessage"
class="PageMessage"
aria-live="polite"
></p>
</div>
</main>
<script src="/Scripts/Garden/PlantImages.js"></script>
<script src="/Scripts/Garden/Plants.js"></script>
<script src="/Scripts/Garden/Mutations.js"></script>
<script src="/Scripts/Garden/Save.js"></script>
<script src="/Scripts/Garden/AdminMutationEditor.js"></script>
</body>
</html>
+225
View File
@@ -0,0 +1,225 @@
<?php
$PageTitle = "Admin plants";
$PageSection = "Admin";
?>
<!DOCTYPE html>
<html lang="en" data-palette="CatppuccinMocha">
<?php require __DIR__ . "/Bits/Head.php"; ?>
<body>
<?php require __DIR__ . "/Bits/Navbar.php"; ?>
<main class="MainContainer">
<h1>Plant editor</h1>
<p>
Add plants or edit existing catalogue data. Numeric IDs
and existing Plant Keys stay permanent once created.
</p>
<p
id="AdminAccessMessage"
class="PageMessage"
aria-live="polite"
>
Checking admin access...
</p>
<div
id="AdminContent"
hidden
>
<div class="AdminEditorToolbar">
<label for="AdminPlantSelect">
Plant
</label>
<select id="AdminPlantSelect"></select>
<button
id="AdminPlantNewButton"
class="ActionButton AdminInlineButton"
type="button"
>
New plant
</button>
</div>
<form
id="AdminPlantForm"
class="Panel AdminEditorForm"
>
<div class="AdminEditorGrid">
<label class="AdminEditorField">
<span>ID</span>
<input
id="AdminPlantId"
name="Id"
type="number"
min="1"
step="1"
required
>
<small>
Permanent. New plants default to the next ID.
</small>
</label>
<label class="AdminEditorField">
<span>Plant Key</span>
<input
id="AdminPlantKey"
name="PlantKey"
type="text"
maxlength="64"
required
>
<small>
Used by saves, recipes and the sprite folder.
</small>
</label>
<label class="AdminEditorField AdminEditorWideField">
<span>Name</span>
<input
id="AdminPlantName"
name="Name"
type="text"
maxlength="64"
required
>
</label>
<label class="AdminEditorField AdminEditorWideField">
<span>Description</span>
<textarea
id="AdminPlantDescription"
name="Description"
rows="4"
required
></textarea>
</label>
<label class="AdminEditorField AdminEditorWideField">
<span>Tags</span>
<input
id="AdminPlantTags"
name="Tags"
type="text"
placeholder="Rose, Flower, Red"
>
<small>
Comma-separated. Spaces around tags are ignored.
</small>
</label>
<label class="AdminEditorField">
<span>Growth time (ms)</span>
<input
id="AdminPlantGrowthTime"
name="GrowthTime"
type="number"
min="0"
step="1000"
required
>
<small id="AdminPlantGrowthTimeHint"></small>
</label>
<label class="AdminEditorField">
<span>Base seed cost</span>
<input
id="AdminPlantBaseCost"
name="BaseCost"
type="number"
min="0"
step="1"
>
<small>
Used only for plants stocked from the start.
</small>
</label>
<label class="AdminEditorCheckField">
<input
id="AdminPlantShopPlant"
name="ShopPlant"
type="checkbox"
>
<span>
Available in the Shop from the beginning
</span>
</label>
<label class="AdminEditorField AdminEditorWideField">
<span>Effects JSON</span>
<textarea
id="AdminPlantEffects"
name="Effects"
rows="6"
spellcheck="false"
></textarea>
<small>
Keep this as <code>{}</code> when the plant has no effects.
</small>
</label>
</div>
<div class="AdminEditorPreview">
<h2>Preview</h2>
<div class="AdminPlantPreviewRow">
<div
id="AdminPlantPreviewTile"
class="PlantTile AdminPlantPreviewTile"
></div>
<div>
<strong id="AdminPlantPreviewName">
New plant
</strong>
<p id="AdminPlantPreviewKey"></p>
<p id="AdminPlantArchiveNote" hidden>
This plant is currently archived.
</p>
</div>
</div>
</div>
<div class="AdminEditorActions">
<button
id="AdminPlantSaveButton"
class="ActionButton AdminSaveButton"
type="submit"
>
Save plant
</button>
<a
class="ActionButton AdminInlineButton AdminEditorBackLink"
href="/Pages/Admin.html"
>
Back to Admin
</a>
</div>
</form>
<p
id="AdminPlantMessage"
class="PageMessage"
aria-live="polite"
></p>
</div>
</main>
<script src="/Scripts/Garden/PlantImages.js"></script>
<script src="/Scripts/Garden/Plants.js"></script>
<script src="/Scripts/Garden/Save.js"></script>
<script src="/Scripts/Garden/AdminPlantEditor.js"></script>
</body>
</html>