Files
gunshiz 3fe17a2ff7
CI / verify (push) Successful in 2m10s
CI / build-and-deploy (push) Successful in 2m14s
feat: add traveler rotation shortcut
2026-09-20 00:00:30 +07:00

87 lines
4.9 KiB
Markdown

# GCSim Translator
A shadcn-powered editor that translates Genshin character builds into paste-ready [gcsim](https://github.com/genshinsim/gcsim) character config blocks.
## Local development
```bash
bun install
bun dev
```
Without `DATABASE_URL`, the editor uses a small fallback catalog. Production reads Buzz Sheet's existing `catalog` schema and images through `S3_PUBLIC_URL`. Team drafts stay in browser `localStorage`; the application never writes to PostgreSQL.
```bash
bun run test
bun run typecheck
bun run lint
```
## Optional rotations
Enable **Include rotation** for a team to append actions to its character blocks:
```text
Mavuika E > Xilonen E N2
```
Use character names or keys from that team, separated by `>` or newlines. Supported shorthand: `E` (skill), `Q` (burst), `N2` (two normals), `C` (charged attack), `D` (dash), `J` (jump), `tE` / `hE` (tap / hold skill), and `W(60)` (wait 60 frames). Combine actions with `N2CD` or repeat groups with `3(N2CD)`; nested groups are supported. Compact repeats such as `2N2D` mean `2(N2D)`: perform two normals and a dash twice. A following spaced action runs once, so `2N2D Q` repeats `N2D` twice, then uses burst. **Repeat rotation** loops the actions until the simulation ends.
When the team contains one Traveler, use `mc` as their character name in shorthand rotations for any element. Generated configs use the Traveler's element-specific gcsim key. The shortcut does not apply to imported gcsim scripts.
Both toggles default to off. Rotation text and settings save with each team in this browser; turning rotation off preserves the text and outputs only builds. Invalid enabled rotations show an error and disable copying. The translator checks shorthand, not combat legality or energy requirements. Enabling rotation automatically includes the fixed action-delay helper above the character builds, then these fixed environment settings below all character stats:
```text
target lvl=100 resist=0.1 radius=2 pos=0,2.4 hp=999999999 freeze_resist=1;
energy every interval=480,720 amount=1;
```
The helper and environment settings are not editable in the app. Rotation actions follow these settings. Add simulation options in gcsim.
## Import from gcsim
Click **Import from gcsim**, paste a config, review the preview, and click **Import team**. Import creates a new team with character levels, constellations, talents, weapons, artifact sets, and exact artifact stat totals. Multiple `add stats` lines are summed without converting their values into roll estimates. Imported stats and artifact piece counts can be edited directly, and numeric character, weapon, and set `+params` are preserved.
Imported rotations remain editable gcsim script, retaining loops, conditionals, waits, and action parameters. **Include rotation** controls whether that script is copied. Use **Clear script and use shorthand** to start a new shorthand rotation instead.
Imports support up to four characters from the current catalog, common character aliases, and Favonius aliases such as `favsword`, `favgs`, `favbow`, `favspear`, and `favcodex`. Unknown catalog entries, malformed build settings, and invalid values show errors before any team is added. Imported simulation options, targets, and energy settings are omitted with a notice in the import preview. Enabled rotations use the fixed defaults, and reimported delay helpers are removed to prevent duplicate definitions. Full script validation happens in gcsim.
## Production
The `gcsim-secrets` Kubernetes secret only needs `DATABASE_URL`. Use a dedicated PostgreSQL role with read-only access to the Buzz Sheet `catalog` schema.
Create the local secret file and replace its database URL:
```bash
cp .env.example .env.production
```
Review the file, select the intended cluster context, and apply it without committing the generated Secret:
```bash
kubectl config current-context
kubectl apply -f k8s/namespace.yaml
kubectl --namespace gcsim create secret generic gcsim-secrets \
--from-env-file=.env.production \
--dry-run=client \
-o yaml | kubectl apply -f -
```
Confirm only the key names, without printing their values:
```bash
kubectl --namespace gcsim get secret gcsim-secrets \
-o go-template='{{range $key, $_ := .data}}{{printf "%s\\n" $key}}{{end}}'
```
After rotating the database credential, restart the application so the Deployment receives it:
```bash
kubectl --namespace gcsim rollout restart deployment/gcsim
kubectl --namespace gcsim rollout status deployment/gcsim --timeout=10m
```
Gitea Actions verifies every push and pull request, then builds and deploys `main` when `DEPLOY_ENABLED=true` and the repository-level `KUBE_CONFIG_B64` Actions secret is configured. `KUBE_CONFIG_B64` is a Gitea Actions secret, not part of `gcsim-secrets`.
The ingress hostname is `gcsim.gunshiz.top`. Buzz Sheet remains responsible for syncing Lunaris data and storing catalog images in Bun S3; this app only reads that shared catalog and public image base.