Repository navigation
Created map for Vatican City - #634
AerosmithTG wants to merge 2 commits into
Conversation
|
This is a very interesting idea, and I think it will be fun to play on. You've definitely got enough nations. |
Yep, lots of nations, but mostly at level 1 so you don't get crushed too instantly... |
|
|
WalkthroughAdds a new “Vatican City” map across client, server, and assets: enum entry, labels, image wiring, loader mapping, playlist/config entries, generation script inclusion, and a new map JSON. Updates English localization with a new key. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Client UI
participant Game Core
participant Loader
participant Assets
User->>Client UI: Select Vatican City map
Client UI->>Client UI: MapDescription label + getMapsImage()
Client UI->>Game Core: Start game with GameMapType.VaticanCity
Game Core->>Loader: loadMapData(GameMapType.VaticanCity)
Loader->>Assets: Fetch VaticanCity.bin/.json/Thumb.webp
Assets-->>Loader: Map data + image
Loader-->>Game Core: Parsed terrain + metadata
Game Core-->>Client UI: Render map
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (2)
src/core/game/TerrainMapFileLoader.ts (1)
59-63: Bug: cache fields mismatch prevents cache hitsMapCache uses bin but loadMapData returns mapBin. getMapData and isMapLoaded check bin, so cache never hits and isMapLoaded stays false.
Apply this patch to align fields:
@@ -interface MapCache { - bin?: string; - miniMapBin?: string; - nationMap?: NationMap; -} +interface MapCache { + mapBin?: string; + miniMapBin?: string; + nationMap?: NationMap; +} @@ - public async getMapData(map: GameMapType): Promise<MapData> { + public async getMapData(map: GameMapType): Promise<MapData> { const cachedMap = this.maps.get(map); - if (cachedMap?.bin && cachedMap?.nationMap) { + if (cachedMap?.mapBin && cachedMap?.nationMap) { return cachedMap as MapData; } @@ public isMapLoaded(map: GameMapType): boolean { const mapData = this.maps.get(map); - return !!mapData?.bin && !!mapData?.nationMap; + return !!mapData?.mapBin && !!mapData?.nationMap; }Alternatively, change loadMapData return fields to bin/miniMapBin.
Also applies to: 99-102
src/client/components/Maps.ts (1)
87-105: Precompute image and use human-friendly alt text; remove dead commentAvoid double getMapsImage() call, improve a11y with user-facing name in alt, and drop the commented binding.
render() { - const mapValue = GameMapType[this.mapKey as keyof typeof GameMapType]; + const mapValue = GameMapType[this.mapKey as keyof typeof GameMapType]; + const img = getMapsImage(mapValue); + const name = + this.translation || + MapDescription[this.mapKey as keyof typeof GameMapType]; return html` <div class="option-card ${this.selected ? "selected" : ""}"> - ${getMapsImage(mapValue) + ${img ? html`<img - src="${getMapsImage(mapValue)}" - alt="${this.mapKey}" + src="${img}" + alt="${name} thumbnail" class="option-image" />` : html`<div class="option-image"> - <p>${this.mapKey}</p> + <p>${name || this.mapKey}</p> </div>`} <div class="option-card-title"> - <!-- ${MapDescription[this.mapKey as keyof typeof GameMapType]}--> - ${this.translation || - MapDescription[this.mapKey as keyof typeof GameMapType]} + ${name} </div> </div> `; }
♻️ Duplicate comments (1)
resources/maps/VaticanCity.json (1)
6-356: Style: “St.” vs “St”Prior comment asked for “St.” with a period. Please confirm the project style and apply consistently.
If you want, I can mass-update these names to “St.” form in a follow-up commit.
🧹 Nitpick comments (10)
src/server/MapPlaylist.ts (1)
79-109: Optional: type the frequency map to avoid key driftObject.keys(GameMapType) + parseInt on possibly undefined values is fragile. Consider a typed map to fail fast at compile time and avoid parseInt on undefined.
Example:
type Freq = Partial<Record<keyof typeof GameMapType, number>>; private getFrequency(playlistType: PlaylistType): Freq { // ... }resources/maps/VaticanCity.json (8)
1-5: Nit: align “name” with existing conventionOther maps often use names without underscores. Consider "VaticanCity" or "Vatican City" for consistency (if this field is displayed).
42-45: Typo: “Vatican Museums” (plural)Use the common English plural form.
- "name": "Vatican Museum", + "name": "Vatican Museums",
52-55: Typo: “Holy Office”Likely “Palace of the Holy Office”.
- "name": "Palace of the Hold Office", + "name": "Palace of the Holy Office",
62-65: Typo: “Cemetery”Correct spelling.
- "name": "Teutonic Cemetary", + "name": "Teutonic Cemetery",
177-180: Typo: “Nicholas V”Add the missing h.
- "name": "Tower of Nicolas V", + "name": "Tower of Nicholas V",
197-200: Consistency: “Gate of St Anne”Matches “Church of St Anne …” above and American English spelling.
- "name": "Gate of St Anna", + "name": "Gate of St Anne",
202-205: Typo: “St Peregrine”Correct the saint’s name.
- "name": "Church of St Peregrin", + "name": "Church of St Peregrine",
292-295: Grammar: add possessiveUse “St Peter’s Memorial”.
- "name": "St Peter Memorial", + "name": "St Peter's Memorial",src/client/components/Maps.ts (1)
34-34: Tighten typing for mapKey (catch typos at compile time)Keep runtime behavior the same but narrow the type.
- @property({ type: String }) mapKey = ""; + @property({ type: String }) mapKey: keyof typeof GameMapType | "" = "";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
resources/maps/VaticanCity.binis excluded by!**/*.binresources/maps/VaticanCity.pngis excluded by!**/*.pngresources/maps/VaticanCityMini.binis excluded by!**/*.bin
📒 Files selected for processing (9)
resources/lang/en.json(1 hunks)resources/maps/VaticanCity.json(1 hunks)src/client/components/Maps.ts(1 hunks)src/client/utilities/Maps.ts(2 hunks)src/core/configuration/DefaultConfig.ts(1 hunks)src/core/game/Game.ts(2 hunks)src/core/game/TerrainMapFileLoader.ts(1 hunks)src/scripts/generateTerrainMaps.ts(1 hunks)src/server/MapPlaylist.ts(1 hunks)
🔇 Additional comments (9)
src/core/game/Game.ts (2)
73-74: Enum entry added: looks goodNew map type VaticanCity is defined. No issues spotted.
97-98: All VaticanCity map wiring verifiedConfirmed entries for GameMapType.VaticanCity:
- src/core/game/TerrainMapFileLoader.ts (line 47)
- src/client/utilities/Maps.ts (case at line 70)
- src/server/MapPlaylist.ts (entry at line 107)
- resources/lang/en.json (
map.vaticancity)- resources/maps/VaticanCity.json
- resources/maps/VaticanCityThumb.webp
No further changes required.
src/scripts/generateTerrainMaps.ts (1)
28-29: PNG resource confirmedThe file resources/maps/VaticanCity.png is present in the repository, so no further changes are needed.
src/server/MapPlaylist.ts (1)
107-108: Playlist entry added: looks goodIncluding VaticanCity in SmallMaps with frequency 1 is consistent.
resources/maps/VaticanCity.json (1)
1-356: Coordinates Sanity Check PassedAll coordinates in
resources/maps/VaticanCity.jsonlie within the declared width (1386) and height (1070). No out-of-bounds entries were found.src/client/utilities/Maps.ts (1)
21-22: Image wiring added: looks goodThumb import and switch case for VaticanCity are correct.
Confirm the image exists (or is generated) at resources/maps/VaticanCityThumb.webp. If this is build-generated, ensure pipeline runs image generation before bundling.
Also applies to: 70-71
resources/lang/en.json (1)
126-128: Translation key added: looks good"vaticancity": "Vatican City" matches map label. No JSON issues.
src/client/components/Maps.ts (2)
29-29: Added map description entry looks goodThe VaticanCity label is consistent with existing naming in this file.
29-29: VaticanCity spelling is consistent
Search results confirm only “VaticanCity” is used (no “VaticanoCity” typos), and all related assets and translation keys exist. No changes needed.
TheGiraffe3
left a comment
There was a problem hiding this comment.
Recently, there have been changes to how maps are created. Could you rename your new files and put them in a new folder? https://github.com/openfrontio/OpenFrontIO/pull/634/files#r2070308554 also needs a resolution.
… honest subscription panel (OPE-231, OPE-314) (#5258) Two commits. The first moves client checkout onto `POST /payments/checkout` so a purchase can run on either rail; the second stops the subscription panel promising access it does not give. ## Merge order **Needs infra #634 merged first.** That PR opens the three gates and inverts the payments kill switch. Without it `{provider:"steam"}` returns 501 and the desktop origin is refused, so merging this first leaves correct-but-unreachable code rather than a broken `main`. Nothing here breaks the Stripe rail in the meantime. ## 1. Rail-agnostic checkout (OPE-231) The rail is chosen client-side by `paymentsProvider()` — Steam inside the desktop shell, Stripe on the web — because the server does not infer it. On the Steam path there is nothing to navigate to: Valve returns `steamurl` for **web sessions only** (confirmed in the ISteamMicroTxn reference), so the overlay dialog is already on the player's screen and we wait for the shell's MicroTxn bridge to report Steam's verdict, then finalize. **Two bugs made every Steam-only SKU unbuyable**, both from gating on the Stripe `product` block, which is `null` for listings that exist only on the Steam rail. `Cosmetics.ts` classified such packs as `blocked` so the buy button never rendered, and the dollar path bailed before calling checkout. The legacy Stripe cosmetic/flare branch still requires `product` — it genuinely needs a `priceId` — so the gate moved to the branch that uses it rather than being deleted. Three rules the money paths depend on, each easy to undo by accident: - **Finalize only on an authorized dialog.** A client-channel order skips the server's abandon rule and settles unconditionally, so finalizing a dismissed dialog charges a player who walked away. - **Finalize answers with four resolutions and only two are terminal.** Folding `open` or `unresolved` into an error is the same mistake as reading `status=pending` on the return page as "purchase failed". `open` is in fact the *expected* answer to a prompt finalize on the client channel. - **Only an explicit `status=false` is a failure** on the return page. Anything unrecognised degrades to pending, so a status value the rail adds later cannot tell a paying player their purchase failed. ## 2. The subscription panel (OPE-314) The cancel copy was false for a granted month. `subscriptions/@me/cancel` expires a grant **immediately** — there is no billing period to run out — and revokes the premium username with it, while the confirm and success strings both promised access "until the end of the current billing period". The grant ledger earns that month once per account ever, so a player who believed the copy destroyed something unrecoverable that they had paid for. The server already suppresses its cancel *email* for exactly this reason; the client copy never got the same treatment. Manage and Reactivate are also removed in the packaged build. Both route to the Stripe billing portal, which `navigationPolicy` refuses, so they were dead buttons reporting a generic technical failure on a billing surface. Static copy replaces them — deliberately no anchor, URL or click handler. **This is harm reduction, not the whole fix.** Hiding Cancel outright for a granted month needs `provider` on `/users/@me`, which is in infra #634. ## Verification Rebased onto current `main` (27 commits) this morning. `tsc --noEmit` clean, `npm run lint` clean, **4556/4556 tests across 359 files**. The rebase surfaced a real conflict worth naming: #5226 refactored the same return-page block while this was in flight, and two of its behaviours would have been silently lost — subscription success now reloads only after the dialog is *dismissed*, and a malformed cosmetic return shows a generic error rather than "purchase failed". Both are preserved, with tests pinning them so a future rebase cannot drop them again. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0199Kyd6ykuPxeMsnh35aAXs --- ## Known limitation: a Steam-only **currency pack or subscription tier** has no price to display Found in review and verified. This PR removes the two `product` gates in `Cosmetics.ts` that classified such a listing as `blocked` and bailed before checkout. It does **not** make one buyable, because a third gate lives in a file this PR does not touch: `Store.ts` renders `.onPurchaseDollar=${product ? () => purchase("dollar") : undefined}`, where `product` is `priced?.product ?? null`. With no Stripe product block there is no dollar handler, so no control appears. **Removing that gate is not sufficient.** `PurchaseButton` already supports a product-less dollar purchase through `dollarPrice`, so the button is renderable. What is missing is the **price**: for a currency pack or a subscription tier the only money price in `cosmetics.json` lives inside `product.price` (`CosmeticSchemas.ts:53-55`, `:95`). When `product` is `null` there is nothing in the catalog to put on the button. So the corollary in THE CONTRACT — "do not gate the buy button on `product` being present" — is incomplete. It says what not to gate on, and never says where the price comes from on a rail with no Stripe product. Infra models price per (SKU x provider x currency) in `sku_listings`, so the data exists server-side; it is not surfaced in the catalog the client reads. ### Scope: this is narrower than it first looks **Cosmetics and cosmetic packs are unaffected.** `CosmeticPackSchema` (`CosmeticSchemas.ts:478-489`) carries a **required** `priceHard` and has no `product` field at all, and those purchases run through `purchasePack()` on the `resolved.type === "cosmeticPack"` branch — nowhere near the dollar path. `PurchaseButton.render()` returns `nothing` only when dollar, hard and soft prices are *all* absent, so a cosmetic pack renders its hard-currency button whether or not `product` is null. The gap is confined to the two kinds that reach `/payments/checkout` by name: `resolved.type === "pack"` (a **currency** pack — the thing you spend money on to obtain Plutonium) and `resolved.type === "subscription"` (a tier). **Impact today is nil, and structurally so.** Every current currency pack carries a Stripe product, so a Steam purchase displays that same dollar price — and the Plutonium price is required to stay consistent across processors anyway, so there is no per-rail divergence to represent. The gap opens only if someone wants a **Steam-exclusive** currency pack or tier, and it needs a rail-independent price on listings before that is possible. Deliberately not bodged here: a buy button with no price is a worse outcome than the honest gap, and the fix belongs where the price data lives. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
… (OPE-314) (#5263) Item 2 of OPE-314 — the blocking half. **Needs a copy sign-off before merge (see the last section); the code is ready.** Buying the base game on Steam grants a free month: a subscription row with `provider IS NULL`, `status: "active"`, `currentPeriodEnd = now + 30d`. The panel rendered that identically to a paid Stripe subscription, and on it **the Cancel button did not cancel, it destroyed.** For a grant the server has no period to run out, so `@me/cancel` sets `status: "expired"` immediately and calls `revokePremiumUsername`, taking the player's premium username with it. It does not come back: the grant ledger earns a grant **once per (account, product), ever**, so the claim stays applied and every later login returns `unchanged`. Only a manual admin `UPDATE` restores it. The panel also said **"Renews {date}"** about a month that never renews. Every base-game buyer in the beta holds one of these, so the affected population is the whole beta cohort. #5258 landed the harm reduction — honest cancel copy, and no dead Manage button on desktop. This is the part that stops the click. ## What changes For `provider === null`: - **No Manage, no Change Tier, no Cancel.** Every control on this panel is about billing and a grant has none: two of them reach a billing account that does not exist, and the third is the one-way door above. - **An ends-on line instead of "Renews {date}".** - **Static copy saying what the subscription actually is** — no anchor, no URL, no click handler, the same shape as `renderManageOnWeb`. Nothing changes for a Stripe or Steam subscription. ## The two things worth reviewing closely **1. `null` and `undefined` must not collapse.** `provider` reaches the client for the first time here (infra #634). It is on infra `main` but **not yet on staging**, so an absent field is the live case until the next deploy. | value | meaning | behaviour | | -- | -- | -- | | `"stripe"` / `"steam"` | paid, someone is being billed | unchanged | | `null` | granted | hide the destructive controls | | `undefined` | the server predates the field | **unchanged** — we cannot tell | On an old server a grant is indistinguishable from a Stripe subscription, so `undefined` keeps today's behaviour, **Cancel included**: hiding it there would take away the one control a paying subscriber genuinely needs. Hence `=== null`, never `!provider` — which is true for both and silently reintroduces the bug on one path. Both states are tested separately, and the truthiness version fails those tests (verified by mutating `isGranted` to `!this.sub.provider`: 7 failures; and to a constant `false`: 6 failures). **2. Not gated on `isDesktopShell()`**, unlike the Manage/Reactivate change in #5258. A grant is a property of the **account**, not of the shell — a Steam buyer who signs in on the website sees the same panel and would meet the same one-way Cancel there. There is a test for that. ## Two smaller judgement calls **The note has two variants.** `provider IS NULL` has two writers and only one of them sets an end date: a Steam ownership grant is a fixed free month, an admin comp (`players/[playerId]/subscriptions` POST) is open-ended with `currentPeriodEnd` null. Telling a comped player their access came from a Steam purchase would be a fresh instance of exactly the dishonesty this PR removes — so the "Included free with your Steam purchase" wording is only used where there is an end date. Both variants hide the same controls; only the sentence differs. **`provider` is `z.string().nullable().optional()`, not `z.enum(["stripe", "steam"])`,** matching `status` immediately above it. A parse failure fails the *whole* `/users/@me` response — `Api.ts` logs and returns `false`, and the account view goes blank — so a rail added server-side must not be able to brick every client that shipped before it. An unrecognised value is simply not `null`, which lands on the paid behaviour, the safe side. ## Verification - `npx vitest run` — 359 files, 4581 tests, all passing (includes `TranslationSystem` and `EnJsonSorted`). - `tsc --noEmit`, `npm run lint`, `prettier --check .` — all clean. - Both mutation controls above. ## Copy — needs sign-off, not merged until then Three new keys in `en.json`. `sub_renews_on` is untouched and still used for paid subscriptions. ``` "sub_granted_ends_on": "Free access ends {date}", "sub_granted_from_purchase": "Included free with your Steam purchase. It isn't billed and doesn't renew, so there's nothing to manage or cancel.", "sub_granted_indefinite": "Free access granted to your account. It isn't billed, so there's nothing to manage or cancel." ``` No existing key means the same thing (the meaning genuinely changed — renews vs ends), so these are new rather than reused. As with #5258, only `en.json` is touched; Crowdin picks the rest up. If you would rather collapse the two note variants into one, that is a one-line change in `renderGrantedNote`. ## Not in scope **Item 4** (the Steam rail's Manage → `store.steampowered.com/account/`, and the in-app-cancel policy question) rides with Phase 9 / OPE-230 and is untouched. The branch name carries `ope-314`, so merging this will likely auto-close the ticket again — item 4 still needs it open. Also noticed and deliberately not changed: removing Change Tier for a grant takes the upgrade-to-paid affordance off *this panel* on web too. The subscriptions store is still reachable as its own modal, so no path is lost. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015W7jtCfHb3sehSKqGodK7o Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Description:
A Vatican city map with many different 'nations' for landmarks in the Vatican. Based upon the commented photo for locations of nations. Not topographical, region height is used to distinguish between buildings, paths, and gardens. Map PNG is last photo attached but most fountains are removed when map is built.
Please put your Discord username so you can be contacted if a bug or regression is found:
.aerosmith.