Files
devplacepy/devplacepy/templates/_game_grid.html
T
retoor 6f340a6818 feat: add per-user avatar seed regeneration with irreversible random avatar replacement
Implement a new `avatar_seed` column on the users table that overrides the username-based seed for Multiavatar generation. Introduce a null-safe `avatar_seed(user)` choke point in `avatar.py` that resolves `user.get("avatar_seed") or user.get("username")`, registered as a Jinja global so every render site (`_avatar_link.html`, `avatar_url(...)` calls, SEO `og_image`, issues ad-hoc dicts, devRant payload/PNG) propagates a regenerated seed. Add `POST /profile/{username}/regenerate-avatar` endpoint (owner-or-admin only) that writes a fresh `generate_uid()` to `avatar_seed`, invalidates the target's user cache, and audits `profile.avatar.regenerate`. The previous seed is overwritten and never stored, making regeneration irreversible. Document the feature in `AGENTS.md` and `README.md`, add the API endpoint to `docs_api.py`, and include the `regenerate_avatar` Devii tool in `CONFIRM_REQUIRED`.
2026-06-27 22:31:34 +00:00

62 lines
3.6 KiB
HTML

<div class="game-grid" data-game-grid>
{% for plot in farm.plots %}
<div class="game-plot game-plot-{{ plot.state }}{% if plot.is_golden %} game-plot-golden{% endif %}" data-slot="{{ plot.slot }}" data-state="{{ plot.state }}" data-ready-at="{{ plot.ready_at }}">
{% if plot.state == 'empty' %}
{% if farm.is_owner %}
<form class="plot-plant-form" method="post" action="/game/plant" data-game-action="plant">
<input type="hidden" name="slot" value="{{ plot.slot }}">
<select name="crop" class="plot-crop-select" aria-label="Choose a project to build">
{% for crop in farm.crops %}
<option value="{{ crop.key }}"{% if crop.locked or crop.cost > farm.coins %} disabled{% endif %}>{{ crop.icon }} {{ crop.name }} - {{ crop.cost }}c{% if crop.locked %} (Lv {{ crop.min_level }}){% endif %}</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-sm btn-primary">Plant</button>
</form>
{% else %}
<span class="plot-empty-label">Empty plot</span>
{% endif %}
{% elif plot.state == 'growing' %}
<span class="plot-icon" aria-hidden="true">{{ plot.crop_icon }}</span>
<span class="plot-crop-name">{{ plot.crop_name }}</span>
<span class="plot-timer" data-plot-timer data-ready-at="{{ plot.ready_at }}">building</span>
<span class="plot-water-count">{{ plot.watered_count }}/{{ plot.max_waters }} &#128167;</span>
{% if plot.can_water %}
<form method="post" action="/game/farm/{{ farm.owner_username }}/water" data-game-action="water">
<input type="hidden" name="slot" value="{{ plot.slot }}">
<button type="submit" class="btn btn-sm">&#128167; Water</button>
</form>
{% endif %}
{% if farm.is_owner and plot.fertilize_cost %}
<form method="post" action="/game/fertilize" data-game-action="fertilize">
<input type="hidden" name="slot" value="{{ plot.slot }}">
<button type="submit" class="btn btn-sm">&#9889; Fertilize ({{ plot.fertilize_cost }}c)</button>
</form>
{% endif %}
{% else %}
<span class="plot-icon plot-ready-icon" aria-hidden="true">{{ plot.crop_icon }}</span>
<span class="plot-crop-name">{{ plot.crop_name }}{% if plot.is_golden %} &#10024;{% endif %}</span>
{% if farm.is_owner %}
<form method="post" action="/game/harvest" data-game-action="harvest">
<input type="hidden" name="slot" value="{{ plot.slot }}">
<button type="submit" class="btn btn-sm btn-primary">Harvest{% if plot.is_golden %} golden{% endif %}</button>
</form>
{% elif plot.can_steal %}
<form method="post" action="/game/farm/{{ farm.owner_username }}/steal" data-game-action="steal">
<input type="hidden" name="slot" value="{{ plot.slot }}">
<button type="submit" class="btn btn-sm btn-danger" data-confirm="Steal this ready build?">Steal +{{ plot.steal_coins }}c</button>
</form>
{% elif plot.steal_reason == 'cooldown' %}
<span class="plot-ready-label plot-steal-locked">Raided recently</span>
{% else %}
<span class="plot-ready-label">Ready</span>
{% endif %}
{% endif %}
</div>
{% endfor %}
{% if farm.is_owner and farm.plot_count < farm.max_plots %}
<form class="game-plot game-plot-buy" method="post" action="/game/buy-plot" data-game-action="buy-plot">
<button type="submit" class="btn btn-sm">+ New plot ({{ farm.next_plot_cost }}c)</button>
</form>
{% endif %}
</div>