# [MOR] Mortuary Protocol — Alliance Reference Site

A static fan-made reference site for **[MOR] Mortuary Protocol** in *Last Asylum: Plague*. Hosts the v3.2 planner, officer-pinned builds, server-specific event schedule, hero recommendations, and weekly digests for members who don't use Discord.

**Domain:** `mortuaryprotocol.org` (when published)
**Stack:** plain HTML + CSS + JS · zero build step · Cloudflare Pages (free tier)
**Local-only state:** everything in the planner lives in your browser's `localStorage`. Nothing leaves your machine.

---

## What's in v1

| Path | What it is | Edit in |
|---|---|---|
| `/` | Home / landing — what the site is, cards to all sections, leader-pitch copy | `index.html` |
| `/planner/` | The full v3.2 planner (multi-instance buildings, survivors, branching research tree, sanctuary table, hero catalog) | `planner/` (copied from the v3.2 build) |
| `/research/` | Read-only research tree viewer pulling from the planner's data | `research/index.html` |
| `/sanctuary/` | Read-only 30-row sanctuary table with your current level highlighted | `sanctuary/index.html` |
| `/builds/` | Officer-pinned build guides (Alliance Duel defense, Canyon Conquest ranged) | `builds/*.html` |
| `/schedule/` | Server-specific event schedule with cadence + windows | `schedule/index.html` |
| `/heroes/` | Hero recommendations for our server age, layered over public tier lists | `heroes/index.html` |
| `/digest/` | Weekly "what you missed on Discord" digest | `digest/index.html` |
| `/contact/` | Discord invite + R4/R5 contact info + non-Discord contact path | `contact/index.html` |
| `/assets/` | Shared site CSS + JS (header/footer injector, theme) | `assets/*` |
| `/_cloudflare/_headers` | Cache + security headers (CSP, X-Frame-Options, etc.) | `_cloudflare/_headers` |

**Read-only v1.** No forms, no logins, no server-side state. Anything interactive (the planner) stores data in the visitor's browser only.

---

## File tree

```
mortuary-protocol-site/
├── index.html                   ← home
├── planner/                     ← v3.2 planner (8 files, copy of lap-planner)
│   ├── app.js
│   ├── data.js
│   ├── index.html
│   ├── styles.css
│   ├── _idcheck.js
│   └── _smoketest.js
├── research/index.html
├── sanctuary/index.html
├── builds/
│   ├── index.html
│   ├── duel-defense.html
│   └── canyon-conquest-ranged.html
├── schedule/index.html
├── heroes/index.html
├── digest/index.html
├── contact/index.html
├── assets/
│   ├── site.css
│   ├── site.js
│   └── partials.js              ← header/footer injector
├── _cloudflare/
│   └── _headers                 ← security + cache headers
└── README.md                    ← you are here
```

Total: ~18 source files. The planner is the bulk (~70 KB of `data.js`).

---

## How to deploy to Cloudflare Pages (mortuaryprotocol.org)

This is the only step that needs a real server-side action. After this, the rest is Git-pushes.

### One-time setup (≈ 10 min)

1. **Create a GitHub repo** for this folder. Push the contents.
   - If the repo is private, you can still use Cloudflare Pages on the free tier.
2. **Cloudflare dashboard → Pages → Create a project → Connect to Git.**
   - Select your GitHub repo.
   - **Build settings:** Framework preset = **None**. Build command = *(leave empty)*. Build output directory = *(leave empty — the site root is the publish dir)*.
   - Click **Save and Deploy**. First deploy takes ~1 min.
3. **Custom domain:**
   - Pages project → **Custom domains → Set up a custom domain → `mortuaryprotocol.org`** (and `www.mortuaryprotocol.org` if you want both).
   - Cloudflare will detect that the domain is already on Cloudflare DNS and auto-add the CNAME. If the domain is parked with a different registrar, point the apex `A` to `192.0.2.1` and the `www` `CNAME` to `<your-pages-subdomain>.pages.dev`, then add the domain in Pages.
4. **Set the canonical URL** in `index.html` if you want SEO hints (currently commented-friendly). Cloudflare auto-issues a Let's Encrypt cert within minutes.

### Per-update workflow (≈ 30 sec)

1. Edit a file locally (or in the GitHub web editor).
2. `git commit -am "..." && git push origin main`
3. Cloudflare Pages auto-builds + auto-deploys. Members see the change on their next page load (or sooner if they hard-refresh — the planner's `data.js` is `max-age=86400` cached, so if you change it, officers should announce "hard-refresh" to members).

---

## Local preview

You can preview the site locally without any server:

```bash
# from the mortuary-protocol-site folder
python -m http.server 8000
# or
npx serve -p 8000
```

Then open `http://localhost:8000`. The planner works fully (it uses `localStorage` so your data persists in the browser).

The `planner/` subfolder is a copy of the v3.2 planner. To update the planner when the v3.2 build gets a new version, just re-copy:

```bash
cp /path/to/lap-planner/{app,data,index,styles}.js{,.css} /path/to/mortuary-protocol-site/planner/
```

(Where `{a,b}` syntax is shell-dependent; in PowerShell use `Copy-Item` per file.)

---

## How officers edit content

### Markdown content (no rebuild needed)

Every page is hand-written HTML. Officers edit the HTML directly. Suggested workflow:

- For a small change: use the **GitHub web editor** (github.com → your repo → click file → pencil icon).
- For a big change: clone the repo locally, edit in your editor, push.

### For non-technical officers (Decap CMS, v1.1)

If you want R5's who don't use Git to publish, [Decap CMS](https://decapcms.org/) is a 1-day add-on:

- It gives you a web form at `/admin/` on the site.
- Officers log in with their GitHub account.
- Form submissions write back to the GitHub repo as commits.
- Cloudflare Pages auto-deploys.

I haven't included Decap in v1 — say the word and I'll add it.

---

## Data sources (all public)

| Topic | Source |
|---|---|
| Sanctuary upgrades (all 30) | https://lastasylumwiki.com/docs/sanctuary-upgrade/ |
| Sanctuary unlocks (multi-instance) | https://lastasylumwiki.com/docs/sanctuary-details/ |
| Events | https://lastasylumwiki.com/docs/events-overview/ + official `#📜patch-notes` |
| Research path | https://lastasylumwiki.com/docs/research-path/ |
| Heroes | https://lastasylumplague.com/heroes/ + Packsify / PocketGamer / topuplive / LDShop tier lists |
| Official patch history | Discord `#📜patch-notes` (server 1417476085179748507) — 8 update logs Jun–Sept 2026 |
| Developer roadmap | Discord `#❓dev-dialogue` (same server) — Developer Dialogue Vol.1–6, Jan–Aug 2026 |
| Active gift codes | Discord `#🎁giftcode` + `#📚player-guide` "CODES" thread |

This site is **not affiliated with Cloudwalker Ltd. or 37GAMES.**

---

## v1.1 / v2 / future

### v1.1 — non-technical editing (Decap CMS)
- 1 day of work.
- Officer web form for builds, digest entries, and contact info.

### v2 — members-only via per-member invite codes
- 1 day of work.
- Cloudflare Worker + KV allowlist.
- Each member gets a unique code (sent via Discord DM, WhatsApp, SMS, or in person for Discord-refusers).
- Site validates the code and sets a long-lived cookie.
- The 1–2 members who refuse Discord get the same code path — they don't need to install Discord.
- Cloudflare Access with email one-time-pin is the alternative (~2 hours to set up, but worse UX).

### v3 — actual interactive features
- Sign-up form for Alliance Duel coordination.
- Members log their own daily progress (writes to a D1 database).
- Discord webhook pings when the digest is updated.

### v3.5 — multiple alliance support
- The site is currently [MOR]-specific. If we want to spin up a sister site for a friend alliance, the v1 architecture generalizes — duplicate the repo, swap the alliance name + domain, deploy to a new Pages project.

---

## Validation (smoke tests)

The planner has its own Node tests:

```bash
cd planner/
node _smoketest.js   # 3 test scenarios, 30 sanctuary rows, formatter sanity, multi-instance + research assertions
node _idcheck.js     # 33 HTML ids match 33 app.js references
```

The site pages don't have automated tests (yet) — they're hand-written HTML. To smoke-check after a content change, open each `/index.html` in a browser and confirm it renders.

---

## What I'd add next

If we get a green light from the leader, the first thing I'd want is **a real digest** for the most recent week. The current `/digest/` entry is a placeholder so the page has something to render — the first real Monday digest should be the one officers write and publish.

Then in order of value:
1. **Decap CMS** so non-technical R5s can publish.
2. **2nd + 3rd builds** (Era of Revival, Undead Siege, Pandemic Experience).
3. **Server-specific event schedule** — once we have one full season of data, replace the standard cadence table with our actual server's registration windows.

---

## Contact

- R4 (this site) — open a GitHub issue or DM in the alliance Discord.
- R5 (leader) — see `/contact/`.

Last updated 2026-09-02.
