forked from unimatrix/web
Publish shared claim tariffs and web-only Home Block placeholders
This commit is contained in:
parent
2aca998700
commit
8bc629c3ac
11 changed files with 116 additions and 5 deletions
64
docs/design/CLAIMS-HOME-BLOCK-BRIDGE.md
Normal file
64
docs/design/CLAIMS-HOME-BLOCK-BRIDGE.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# Claims: web-first catalogue and future Home Block bridge
|
||||
|
||||
Current batch: public rates and CP placeholders only. Catalogue:
|
||||
`website/control-panel/public/cp-v2/cp-v2-claim-tariffs.mjs`, shared by public guide,
|
||||
Claims page, clan settings and dashboard. It assigns no actual tier or claim.
|
||||
Capacity is total whole chunks per organisation; company/protected capacity is
|
||||
floored after ×1.5. Their cost factors are respectively ×1.5 and ×0.5, applied to
|
||||
both monthly and one-time prices. Do not stack multipliers or recalculate prices
|
||||
from rounded capacity. A chunk is 16×16 blocks, not a radius.
|
||||
|
||||
The dossier/workflow backend is UNDECIDED: osTicket or another implementation.
|
||||
Do not add ticket-schema assumptions, provision an osTicket instance or bind web
|
||||
forms to a chosen backend in this phase. Reserved API names describe an interface,
|
||||
not a selected storage/workflow implementation. Backend simulation tests below
|
||||
belong to the later backend/night run, not this placeholder-only web batch.
|
||||
|
||||
## Reserved API contract — not live endpoints
|
||||
|
||||
- Root: `/api/v1/claims/home-blocks`.
|
||||
- Read one block: `GET /api/v1/claims/home-blocks/{homeBlockId}`.
|
||||
- Game intent: `POST /api/v1/claims/home-blocks/{homeBlockId}/commands`.
|
||||
- Verified game results/events: `POST /api/v1/claims/home-blocks/{homeBlockId}/events`.
|
||||
|
||||
Use a stable homeBlockId UUID for upgrades, conquest and server events. Record
|
||||
organisation kind/id, server/world UUID, anchor coordinates, desired/applied
|
||||
revision, mapped WorldGuard region IDs, request/event IDs and correlation IDs.
|
||||
Protected eligibility and authority come from server records, never a browser
|
||||
tariff selector. Protect game requests with the established bridge authentication,
|
||||
bounded freshness/replay checks and explicit server scope; no browser-held game
|
||||
credential or raw shell/WorldGuard command endpoint.
|
||||
|
||||
Command names reserved: `claim.tier.upgrade`, `claim.conquest`, `claim.server-event`.
|
||||
Events include `claim.upgrade.requested`, `claim.upgrade.applied`,
|
||||
`claim.upgrade.failed`, `claim.conquest.started`, `claim.conquest.resolved`,
|
||||
`claim.server-event.started`, `claim.server-event.ended`.
|
||||
|
||||
Claim-capacity upgrades originate ingame by RIGHT-CLICKING THE HOME BLOCK.
|
||||
The website reads limits, rates and status. Organisation-status keys continue to
|
||||
use central Redeem; they are distinct from the Home Block's capacity-tier action.
|
||||
Conquest is a later mother-house feature, not part of Basic. Server events also
|
||||
attach to this same Home Block identity. The game implementation comes later.
|
||||
|
||||
## Future game adapter
|
||||
|
||||
Use the existing central API and DuneProtect integration with a WorldGuard adapter.
|
||||
Inspect installed versions and existing region/priority rules before implementing.
|
||||
Map only explicitly managed claim regions. Never overwrite unrelated/global/staff
|
||||
regions. Region dimensions, vertical bounds and overlap policy need confirmation.
|
||||
The web must distinguish requested/quoted, pending game application, applied,
|
||||
failed/reconciliation states. Do not report a changed region or paid upgrade
|
||||
merely because a command was accepted. Bank charging needs durable idempotency and
|
||||
an explicit failure/reconciliation policy across the bank and game systems.
|
||||
|
||||
## Required backend tests before the ingame adapter exists
|
||||
|
||||
Use a fake authenticated game adapter and a dry-run developer command to simulate
|
||||
right-clicks, conquest and server events. Never mutate real balances, regions or
|
||||
ownership during dry runs. Tests must cover correct sequential price/capacity,
|
||||
key/status requirements, owner/officer permissions, protected restrictions,
|
||||
insufficient funds, forged organisation/server/world, stale revisions, duplicate
|
||||
requests/events, missing/occupied anchors, conflicting regions, WorldGuard timeout
|
||||
or rejection, failure/retry reconciliation and replayed conquest/server events.
|
||||
Distinguish simulated acceptance from actual game confirmation. Later run the
|
||||
same contract tests against a real WorldGuard adapter in a test world.
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import {claimTariffs} from './cp-v2/cp-v2-claim-tariffs.mjs';
|
||||
import {createOrganisationSettings} from './organisation-settings.mjs';
|
||||
import {loadClanTreasury,loadClanMail} from './clan-dashboard-data.mjs';
|
||||
import {createOrganisationDashboard} from './organisation-dashboard.mjs';
|
||||
|
|
@ -16,7 +17,7 @@ export function organiseClanProfile(host,data,{initialView='overview',motdForm=n
|
|||
}
|
||||
table?.remove();roster.append(grid);
|
||||
const requests=host.querySelector('.clan-requests');if(requests)panels.set('requests',{label:'Join requests',panel:requests});
|
||||
const settingsNodes=[...host.querySelectorAll('[data-clan-settings]')];if(settingsNodes.length){const settings=el('section'),forms=[...settingsNodes[0].querySelectorAll(':scope > form')],leader=el('button','Open member management →');leader.type='button';leader.onclick=()=>openPage('roster');const motd=motdForm||el('p','Only the clan owner can publish the message of the day.');const archive=settingsNodes.find(n=>n.classList.contains('clan-danger'));settings.append(createOrganisationSettings([{title:'Identity & homeworld',description:'Clan name, banner tag, description and homeworld.',content:forms[0]},{title:'Clan emblem',description:'Your shared identity on the dashboard, directory and member profiles.',content:forms[1]},{title:'Message of the day',description:'Publish a separate welcome message for your members.',content:motd},{title:'Leadership & roles',description:'Member roles and ownership transfers use the existing authorised member controls.',content:leader},{title:'Relations & subhouses',description:'Parent organisations, subhouses and subsidiaries will be managed here.',pending:true},{title:'Archive clan',description:'Review the existing archive conditions and confirmation before making changes.',content:archive,danger:true}]));for(const node of settingsNodes)if(node!==archive)node.remove();panels.set('settings',{label:'Clan Settings',panel:settings});}
|
||||
const settingsNodes=[...host.querySelectorAll('[data-clan-settings]')];if(settingsNodes.length){const settings=el('section'),forms=[...settingsNodes[0].querySelectorAll(':scope > form')],leader=el('button','Open member management →');leader.type='button';leader.onclick=()=>openPage('roster');const motd=motdForm||el('p','Only the clan owner can publish the message of the day.');const claimInfo=el('div'),claimTiers=claimTariffs(data.clan.institution?.protected?'protected':'clan');for(const stage of ['Basic','Keyed','Royal']){const rows=claimTiers.filter(row=>row.stage===stage);claimInfo.append(el('p',stage+': '+rows[0].chunks+'–'+rows.at(-1).chunks+' total chunks'));}claimInfo.append(el('p','Upgrade claim capacity ingame by right-clicking the Home Block.'));const claimLink=el('a','View claim charter & prices →');claimLink.href='https://clans.dunerealms.com/#clan/clan-claims';claimLink.target='_top';claimInfo.append(claimLink);const archive=settingsNodes.find(n=>n.classList.contains('clan-danger'));settings.append(createOrganisationSettings([{title:'Identity & homeworld',description:'Clan name, banner tag, description and homeworld.',content:forms[0]},{title:'Clan emblem',description:'Your shared identity on the dashboard, directory and member profiles.',content:forms[1]},{title:'Message of the day',description:'Publish a separate welcome message for your members.',content:motd},{title:'Leadership & roles',description:'Member roles and ownership transfers use the existing authorised member controls.',content:leader},{title:'Claim charter & capacity',description:'Planned claim limits, Home Block upgrades and upkeep. No current tier is assigned by this preview.',content:claimInfo,pending:true},{title:'Relations & subhouses',description:'Parent organisations, subhouses and subsidiaries will be managed here.',pending:true},{title:'Archive clan',description:'Review the existing archive conditions and confirmation before making changes.',content:archive,danger:true}]));for(const node of settingsNodes)if(node!==archive)node.remove();panels.set('settings',{label:'Clan Settings',panel:settings});}
|
||||
for(const [id,value]of panels){value.panel.classList.add('clan-profile-panel');value.panel.dataset.clanPanel=id;const button=el('button',value.label);button.type='button';button.onclick=()=>select(id);value.button=button;nav.append(button);}
|
||||
function select(id){nav.hidden=dedicated;for(const [key,{panel,button}]of panels){panel.hidden=key!==id;button.setAttribute('aria-current',key===id?'page':'false');}}
|
||||
host.append(nav);for(const {panel}of panels.values())host.append(panel);select(panels.has(initialView)?initialView:'overview');
|
||||
|
|
|
|||
15
website/control-panel/public/cp-v2/cp-v2-claim-tariffs.mjs
Normal file
15
website/control-panel/public/cp-v2/cp-v2-claim-tariffs.mjs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Universal public catalogue: used by the tariff guide and CP previews.
|
||||
// Publication is not activation of claims, billing or organisation status.
|
||||
export const CLAIM_TARIFF_VERSION='claims-1.0.0.9-v1';
|
||||
export const CLAIM_TARIFF_STATUS='planned';
|
||||
const base=[
|
||||
['BC_T0',1,0],['BC_T1',2,200],['BC_T2',3,400],['BC_T3',4,600],
|
||||
['KC_T0',4,500],['KC_T1',6,800],['KC_T2',9,1200],['KC_T3',12,1600],['KC_T4',16,2200],
|
||||
['RC_T0',16,1800],['RC_T1',20,2400],['RC_T2',25,3000],['RC_T3',36,4400]
|
||||
];
|
||||
export const CLAIM_ORGANISATIONS=Object.freeze({clan:Object.freeze({name:'Clans',description:'Standard clan claim limits and fees.',sizeNumerator:1,costNumerator:2}),company:Object.freeze({name:'Companies',description:'1.5× claim capacity and 1.5× fees.',sizeNumerator:1.5,costNumerator:3}),protected:Object.freeze({name:'Protected Houses',description:'1.5× claim capacity and half the standard fees. Protected institutions such as Spacing Guild.',sizeNumerator:1.5,costNumerator:1})});
|
||||
export function claimTariffs(kind='clan'){
|
||||
const organisation=CLAIM_ORGANISATIONS[kind];if(!organisation)throw new TypeError('Unknown claim organisation');
|
||||
return base.map(([code,chunks,upkeepMinor],index)=>Object.freeze({code:kind==='company'?code.replace('C_','CO_'):kind==='protected'?'P'+code:code,stage:code.startsWith('BC')?'Basic':code.startsWith('KC')?'Keyed':'Royal',chunks:Math.floor(chunks*organisation.sizeNumerator),upkeepMinor:upkeepMinor*organisation.costNumerator/2,unlockMinor:index?(10*upkeepMinor+2000*(chunks-base[index-1][1]))*organisation.costNumerator/2:0,requirement:code==='KC_T0'?(kind==='company'?'COM-key':'CLAN-key'):code==='RC_T0'?'Political appointment + POL-key':null}));
|
||||
}
|
||||
export const claimMoney=minor=>(minor/100).toFixed(2)+' DM';
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
import {element as el} from './cp-v2-page-template.mjs';
|
||||
import {claimTariffs,claimMoney,CLAIM_TARIFF_VERSION} from './cp-v2-claim-tariffs.mjs';
|
||||
export function mountClaims(host,{kind='clan',name='Your organisation'}={}){
|
||||
const root=el('section',undefined,'claims-workspace'),hero=el('div',undefined,'claims-banner');hero.append(el('small','LAND & ESTATES'),el('h2',name+' · Claims'),el('p',kind==='company'?'Company premises and Charter Beacons.':'Clan estates, Home Standards and outposts.'));
|
||||
root.append(hero,el('p','Land claims are coming soon. No land is reserved and no payment is taken from this page.','claims-notice'));
|
||||
const rules=el('div',undefined,'claims-grid');for(const [title,copy]of [['One shared claim budget','Every chunk is 16 × 16 blocks. Limits count all chunks claimed by your organisation, not a radius or a separate allowance for each estate.'],['Basic → Keyed → Royal','Start Basic. Your original organisation key enables mother-house status; Royal status requires a political appointment and its new POL-key.'],['Upgrade at your Home Block','Claim-tier upgrades are performed ingame by right-clicking your Home Block. This website displays information; it does not buy or apply claim upgrades.'],['WorldGuard bridge','Future game protection uses the central API and a DuneProtect/WorldGuard adapter. No regions are created or resized by this preview.']]){const card=el('article',undefined,'claims-card');card.append(el('h3',title),el('p',copy));rules.append(card);}root.append(rules);
|
||||
const charter=el('section',undefined,'claims-card'),choice=el('select'),label=el('label','Tariff reference · this does not assign your organisation a tier'),tableWrap=el('div',undefined,'claim-preview-scroll'),table=el('table',undefined,'claim-preview-table');choice.setAttribute('aria-label','Claim tariff reference');for(const [value,title]of kind==='company'?[['company','Company tariffs']]:[['clan','Clan tariffs'],['protected','Protected House tariffs']]){const option=el('option',title);option.value=value;choice.append(option);}label.append(choice);tableWrap.tabIndex=0;tableWrap.setAttribute('role','region');tableWrap.setAttribute('aria-label','Planned claim tier prices');tableWrap.append(table);charter.append(el('h3','Claim charter & capacity'),el('p','Current tier, used chunks, available capacity, Home Block and payment status: not connected yet.'),label,tableWrap,el('p','Upkeep is monthly; unlock prices are paid once per sequential tier. Company capacity/costs × 1.5; protected capacity × 1.5 and costs × 0.5. Capacity rounds down to whole chunks.'));const rates=el('a','Open the full Rates & Charges guide →');rates.href='https://www.dunerealms.com/rates-and-charges.html#claims';rates.target='_top';charter.append(rates,el('small','Published preview · '+CLAIM_TARIFF_VERSION));
|
||||
function paint(){const head=el('thead'),heading=el('tr'),body=el('tbody');for(const text of ['Tier','Total chunks','Monthly upkeep','One-time unlock','Status requirement']){const cell=el('th',text);cell.scope='col';heading.append(cell);}head.append(heading);for(const row of claimTariffs(choice.value)){const tr=el('tr');tr.append(el('th',row.code),el('td',row.chunks),el('td',claimMoney(row.upkeepMinor)),el('td',claimMoney(row.unlockMinor)),el('td',row.requirement||'Previous tier'));body.append(tr);}table.replaceChildren(head,body);}choice.onchange=paint;paint();root.append(charter);
|
||||
const grid=el('div',undefined,'claims-grid');
|
||||
for(const [title,copy,action]of [['Estates','Your registered land and ownership records will appear here.','Register estate'],['Anchors',kind==='company'?'Manage your company’s Charter Beacons.':'Manage your Home Standard and Outpost Standards.','Manage anchors'],['Boundaries','Preview estate borders and check neighbouring claims before confirming changes.','Preview boundaries'],['Upgrades & upkeep','Review expansion requirements, organisation costs and upkeep before confirming.','Review upgrades']]){
|
||||
for(const [title,copy,action]of [['Estates','Your registered land and ownership records will appear here.','View estates'],['Home Block & anchors','Your Home Block, location and WorldGuard synchronisation status will appear here. Right-click the Home Block ingame to upgrade claim capacity.','View Home Block'],['Boundaries','Preview estate borders and check neighbouring claims. The game bridge applies verified protection changes.','View boundaries'],['Upkeep & payments','Your applied tier, monthly upkeep and payment history will appear here. Claim upgrades are initiated ingame.','View upkeep']]){
|
||||
const card=el('article',undefined,'claims-card'),button=el('button',action);button.type='button';button.disabled=true;button.title='Coming soon';card.append(el('h3',title),el('p',copy),el('strong','Coming soon'),button);grid.append(card);
|
||||
}root.append(grid);host.replaceChildren(root);return()=>root.remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,3 +255,7 @@
|
|||
.code-redemption a{color:#efd28b;text-underline-offset:3px}
|
||||
|
||||
.code-office-provider{display:flex;justify-content:center;align-items:center;gap:28px;flex-wrap:wrap;padding:26px 18px;margin:24px 0 0;border-top:1px solid #a28b4d;background:#0b2118;color:#bdc9bd}.code-office-provider-brands{display:flex;align-items:center;gap:22px;flex-wrap:wrap}.code-office-provider img{object-fit:contain;max-width:100%}.code-office-provider a{display:flex;align-items:center;gap:12px;border-left:1px solid #6f704252;padding-left:22px;text-decoration:none;color:#efd28b}.code-office-provider a span{font-size:11px}@media(max-width:450px){.code-office-provider{gap:16px}.code-office-provider-brands{justify-content:center;gap:14px}.code-office-provider a{padding-left:14px}}
|
||||
|
||||
.claim-preview-scroll{overflow:auto;max-width:100%;margin:18px 0;border:1px solid #9f874f;border-radius:10px}.claim-preview-table{width:100%;border-collapse:collapse;text-align:left;min-width:570px}.claim-preview-table th,.claim-preview-table td{padding:12px;border-bottom:1px solid #45634b}.claim-preview-table thead{background:#284c3a;color:#efd28b}.claims-workspace>.claims-card{margin:24px 0}.claims-card>small{display:block;margin-top:14px;color:#bfd0c2}.claims-card select{display:block;max-width:100%;padding:12px;margin-top:10px}
|
||||
|
||||
.claims-workspace>.claims-card{padding:24px;background:linear-gradient(135deg,#193c31,#122c27);border:1px solid #9f874f;border-radius:14px}.claims-workspace .claims-card h3{color:#efd28b}.claims-workspace>.claims-card>p{line-height:1.7}.claims-workspace>.claims-card>a{color:#efd28b}@media(max-width:500px){.claims-workspace>.claims-card{padding:16px}}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import {claimTariffs} from './cp-v2/cp-v2-claim-tariffs.mjs';
|
||||
import {createActivityFeed} from './organisation-activity.mjs';
|
||||
// Shared presentation only. Callers supply verified records and existing navigation.
|
||||
const el=(tag,text,cls)=>{const node=document.createElement(tag);if(text!==undefined)node.textContent=text;if(cls)node.className=cls;return node;};
|
||||
|
|
@ -15,7 +16,7 @@ export function createOrganisationDashboard({kind='clan',organisation,members=[]
|
|||
const applications=card('Applications','nav-support-v2.webp');applications.append(el('p',canReview?(requests.length?requests.length+' '+(requests.length===1?'application awaits':'applications await')+' review.':'No applications are waiting for review.'):'Applications are reviewed by the owner and authorised officers.'));
|
||||
if(canReview){for(const request of requests.slice(0,3))applications.append(el('p',request.username,'organisation-dashboard-request'));if(onRequests)action(applications,'Review applications →',onRequests);}
|
||||
const news=card('News & activity','nav-manual-v2.webp');news.append(createActivityFeed(activity,{emptyMessage:activityStatus==='restricted'?'Activity is visible to organisation members.':activityStatus==='unavailable'?'Activity could not be loaded.':'No clan activity has been recorded yet.'}));
|
||||
for(const [title,art,message] of [['Events','nav-manual-full-v2.webp','Upcoming activities, dates and participation will appear here.'],['Treasury','imperial-postbank-v2.png','Available funds and the account reference will appear here once the authorised bank summary is connected.'],['Land & claims','clans/house-veyr-v1.png','Territory, estate anchors and claim summaries will appear here.']]){const box=card(title,art,{pending:title==='Treasury'?false:true});box.append(el('p',message),el('small','Not connected yet · no records are shown.'));if(title==='Treasury'){const table=el('table');for(const [label,value] of [['Available funds','Not connected'],['Account','Authorised view required']]){const row=el('tr');row.append(el('th',label),el('td',value));table.append(row);}box.append(table);if(loadTreasury){box.querySelectorAll('p,small').forEach(n=>n.remove());table.replaceChildren();const note=el('p','Checking authorised clan funds…');box.append(note);Promise.resolve().then(loadTreasury).then(entity=>{if(!root.isConnected)return;note.textContent=entity.state==='not_activated'?'Clan banking has not been activated.':'Current accounts · Imperial Postbank';table.replaceChildren();for(const account of entity.accounts){const row=el('tr'),link=el('a',account.number);link.href='https://cp.dunerealms.com/#bank/bank-statements/'+encodeURIComponent(account.id);link.target='_top';const cell=el('td');cell.append(link);row.append(cell,el('td',account.available+' DM available'));table.append(row);}if(!entity.accounts.length&&entity.state!=='not_activated')note.textContent='No active current accounts are visible with your bank permissions.';}).catch(()=>{if(root.isConnected){table.replaceChildren();note.textContent='Clan funds could not be confirmed. Open Imperial Postbank to check your access.';}});}else{table.replaceChildren();box.querySelector('p').textContent='Clan funds are available only with authorised banking access.';}const bank=el('a','Open Imperial Postbank →');bank.href='https://cp.dunerealms.com/#bank/bank-overview';bank.target='_top';box.append(bank);}}
|
||||
for(const [title,art,message] of [['Events','nav-manual-full-v2.webp','Upcoming activities, dates and participation will appear here.'],['Treasury','imperial-postbank-v2.png','Available funds and the account reference will appear here once the authorised bank summary is connected.'],['Land & claims','clans/house-veyr-v1.png','Claims share one total chunk budget. Capacity upgrades will be performed ingame by right-clicking the Home Block.']]){const box=card(title,art,{pending:title==='Treasury'?false:true});box.append(el('p',message),el('small','Not connected yet · no records are shown.'));if(title==='Land & claims'){const kind=company?'company':organisation.institution?.protected?'protected':'clan',tiers=claimTariffs(kind);for(const stage of ['Basic','Keyed','Royal']){const rows=tiers.filter(row=>row.stage===stage);box.append(el('p',stage+': '+rows[0].chunks+'–'+rows.at(-1).chunks+' total chunks'));}const link=el('a','View claim tiers & requirements →');link.href=company?'https://corp.dunerealms.com/#company/company-claims':'https://clans.dunerealms.com/#clan/clan-claims';link.target='_top';box.append(link,el('small','Current tier and used chunks are not connected yet.'));}if(title==='Treasury'){const table=el('table');for(const [label,value] of [['Available funds','Not connected'],['Account','Authorised view required']]){const row=el('tr');row.append(el('th',label),el('td',value));table.append(row);}box.append(table);if(loadTreasury){box.querySelectorAll('p,small').forEach(n=>n.remove());table.replaceChildren();const note=el('p','Checking authorised clan funds…');box.append(note);Promise.resolve().then(loadTreasury).then(entity=>{if(!root.isConnected)return;note.textContent=entity.state==='not_activated'?'Clan banking has not been activated.':'Current accounts · Imperial Postbank';table.replaceChildren();for(const account of entity.accounts){const row=el('tr'),link=el('a',account.number);link.href='https://cp.dunerealms.com/#bank/bank-statements/'+encodeURIComponent(account.id);link.target='_top';const cell=el('td');cell.append(link);row.append(cell,el('td',account.available+' DM available'));table.append(row);}if(!entity.accounts.length&&entity.state!=='not_activated')note.textContent='No active current accounts are visible with your bank permissions.';}).catch(()=>{if(root.isConnected){table.replaceChildren();note.textContent='Clan funds could not be confirmed. Open Imperial Postbank to check your access.';}});}else{table.replaceChildren();box.querySelector('p').textContent='Clan funds are available only with authorised banking access.';}const bank=el('a','Open Imperial Postbank →');bank.href='https://cp.dunerealms.com/#bank/bank-overview';bank.target='_top';box.append(bank);}}
|
||||
const children=card('Subhouses & subsidiaries','clans/vaerkring-v1.png',{pending:true});children.append(el('p','Clans and companies under your organisation will appear here.'));const relations=el('table'),head=el('thead'),heading=el('tr');for(const label of ['Organisation','Type','Relationship']){const cell=el('th',label);cell.scope='col';heading.append(cell);}head.append(heading);const body=el('tbody'),row=el('tr'),empty=el('td','Hierarchy records are not connected yet.');empty.colSpan=3;row.append(empty);body.append(row);relations.append(head,body);children.append(relations);
|
||||
const mail=card('Mailbox','imperial-post-office-v1.png'),mailStatus=el('p',loadMailbox?'Checking unread clan mail…':'Clan mail is available to the owner and authorised officers.');mailStatus.setAttribute('role','status');mail.append(mailStatus);if(loadMailbox){const link=el('a','Open clan mailbox →');link.href='https://clans.dunerealms.com/#clan/clan-mail';link.target='_top';mail.append(link);Promise.resolve().then(loadMailbox).then(count=>{if(root.isConnected)mailStatus.textContent=Number.isSafeInteger(count)&&count>=0?'You have '+count+' unread '+(count===1?'message.':'messages.'):'Unread count is unavailable.';}).catch(()=>{if(root.isConnected)mailStatus.textContent='Mail service unavailable. Open the mailbox to retry.';});}
|
||||
const attention=card('Needs attention','nav-support-v2.webp');attention.append(el('p',canReview&&requests.length?requests.length+' pending '+(requests.length===1?'application needs':'applications need')+' your attention.':'No additional dashboard alerts are connected yet.'));if(canReview&&requests.length&&onRequests)action(attention,'Open pending applications →',onRequests);return root;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import {claimRatesSection} from './claim-rates-section.mjs';
|
||||
import {SHARED_HEADER} from './portal-navigation.mjs';
|
||||
import {PACKAGES,BANK_VERSION} from '../node/postbank-catalogue.mjs';
|
||||
import {CREDIT_PRODUCTS,CREDIT_VERSION} from '../node/postbank-credit-model.mjs';
|
||||
|
|
@ -6,5 +7,5 @@ export function bankRatesPage(){
|
|||
const version=createHash('sha256').update(JSON.stringify([PACKAGES,CREDIT_PRODUCTS])).digest('hex').slice(0,10);
|
||||
const packages=PACKAGES.map(p=>`<tr><th>${p.name}</th><td>${p.kinds.join(' / ')}</td><td>${(p.monthly/100).toFixed(2)} DM</td><td>${p.extra}</td><td>${p.extra?(p.extraFee/100).toFixed(2)+' DM':'—'}</td><td>${p.unlimitedInstant?'Unlimited':p.instant}</td></tr>`).join('');
|
||||
const credit=CREDIT_PRODUCTS.filter(p=>!p.revolving).map(p=>`<tr><th>${p.name}</th><td>${(p.annualBps/100).toFixed(2)}%</td><td>${p.min}–${p.max} DM</td><td>${p.terms?p.terms.join(', '):'Up to '+p.maxMonths} months</td></tr>`).join('');
|
||||
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Rates & Charges | Imperial Postbank</title><meta name="description" content="Public Imperial Postbank package fees, credit rates and service conditions in Dunemarks."><link rel="stylesheet" href="/bank-rates.css"><link rel="stylesheet" href="/portal-navigation.css"><script src="/portal-navigation.js" defer></script><script src="/bank-rates.js" defer></script></head><body>${SHARED_HEADER}<main><section class="hero"><img src="/assets/imperial-postbank-v2.png" alt="Imperial Postbank"><div><p class="eyebrow">YOUR MONEY. CLEAR TERMS.</p><h1>Rates & Charges</h1><p>A clear guide to your banking costs.</p><span class="stamp">PUBLIC TARIFF GUIDE · ${version}</span></div></section><nav class="sections" aria-label="Tariff sections"><a href="#packages">Accounts & packages</a><a href="#credit">Credit rates</a><a href="#services">Services & taxes</a></nav><aside class="notice"><strong>Alpha service notice</strong><p>All amounts are fictional Dunemarks (DM). Published monthly package prices are not yet collected automatically. This is a game economy, not a real-money banking service.</p></aside><section id="packages"><span class="eyebrow">01 / EVERYDAY BANKING</span><h2>Accounts & packages</h2><p>One current account is included in each package.</p><div class="table-wrap"><table><thead><tr><th>Package</th><th>Client</th><th>Monthly price</th><th>Extra current accounts¹</th><th>Each / month¹</th><th>Instant quota / month</th></tr></thead><tbody>${packages}</tbody></table></div><p class="fine">¹ Published additional-account limits and prices, subject to feature availability. Flow and Pro include a savings account. Pro includes unlimited instant payments with no per-transfer fee. Transfers have no package amount cap; available funds and payment security apply. Start has no instant payments. Instant quotas are server usage limits.</p></section><section id="credit"><span class="eyebrow">02 / BORROWING</span><h2>Credit rates</h2><p>Annual rates for new applications. Your accepted contract and repayment schedule govern your loan.</p><div class="table-wrap"><table><thead><tr><th>Product</th><th>Annual rate</th><th>Principal range</th><th>Available terms</th></tr></thead><tbody>${credit}</tbody></table></div><p class="fine">Launch grants are repayable at 0% interest. Ordinary loans require review and a first instalment of 5% from your own funds before issue. This instalment counts toward repayment and reduces the remaining loan balance. Eligibility, available funding and refinancing conditions apply. Existing fixed-rate contracts retain their agreed rate. Revolving credit is not available.</p></section><section id="services"><span class="eyebrow">03 / TRANSPARENCY</span><h2>Services & taxes</h2><div class="service-grid"><article><h3>Monthly statements</h3><strong>Free</strong><p>Automatically archived PDF statements after month-end.</p></article><article><h3>Balance Guard</h3><strong>1.00 DM / month</strong><p>Published optional price per eligible account. Preference saving is available; protection and charging are not active yet.</p></article><article><h3>Tax policy</h3><strong>Not yet published</strong><p>VAT and account-tax rates await central configuration. No unconfirmed rate is presented as active.</p></article></div></section><section class="document"><div><h2>Your tariff guide</h2><p>Generated from the bank catalogues on each build. Version ${version}. Package terms: ${BANK_VERSION}. Credit terms: ${CREDIT_VERSION}.</p><p class="fine">Catalogue references identify source terms, not a new effective date. Administrative rate editing and automatic downloadable PDF publication are planned. You can print or save this guide as PDF now.</p></div><button onclick="window.print()">Print / Save as PDF</button></section><p class="fine">No private account or transaction data is published here.</p></main><footer><a href="/">DuneRealms</a><a href="/rates-and-charges.html">Rates & Charges</a><a href="https://support.dunerealms.com/">Contact support</a></footer></body></html>`;
|
||||
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Rates & Charges | Imperial Postbank</title><meta name="description" content="Public Imperial Postbank package fees, credit rates, organisation claim tariffs and service conditions in Dunemarks."><link rel="stylesheet" href="/bank-rates.css"><link rel="stylesheet" href="/portal-navigation.css"><script src="/portal-navigation.js" defer></script><script src="/bank-rates.js" defer></script></head><body>${SHARED_HEADER}<main><section class="hero"><img src="/assets/imperial-postbank-v2.png" alt="Imperial Postbank"><div><p class="eyebrow">YOUR MONEY. CLEAR TERMS.</p><h1>Rates & Charges</h1><p>A clear guide to banking and organisation costs.</p><span class="stamp">PUBLIC TARIFF GUIDE · ${version}</span></div></section><nav class="sections" aria-label="Tariff sections"><a href="#packages">Accounts & packages</a><a href="#credit">Credit rates</a><a href="#services">Services & taxes</a><a href="#claims">Land claims</a></nav><aside class="notice"><strong>Alpha service notice</strong><p>All amounts are fictional Dunemarks (DM). Published monthly package prices are not yet collected automatically. This is a game economy, not a real-money banking service.</p></aside><section id="packages"><span class="eyebrow">01 / EVERYDAY BANKING</span><h2>Accounts & packages</h2><p>One current account is included in each package.</p><div class="table-wrap"><table><thead><tr><th>Package</th><th>Client</th><th>Monthly price</th><th>Extra current accounts¹</th><th>Each / month¹</th><th>Instant quota / month</th></tr></thead><tbody>${packages}</tbody></table></div><p class="fine">¹ Published additional-account limits and prices, subject to feature availability. Flow and Pro include a savings account. Pro includes unlimited instant payments with no per-transfer fee. Transfers have no package amount cap; available funds and payment security apply. Start has no instant payments. Instant quotas are server usage limits.</p></section><section id="credit"><span class="eyebrow">02 / BORROWING</span><h2>Credit rates</h2><p>Annual rates for new applications. Your accepted contract and repayment schedule govern your loan.</p><div class="table-wrap"><table><thead><tr><th>Product</th><th>Annual rate</th><th>Principal range</th><th>Available terms</th></tr></thead><tbody>${credit}</tbody></table></div><p class="fine">Launch grants are repayable at 0% interest. Ordinary loans require review and a first instalment of 5% from your own funds before issue. This instalment counts toward repayment and reduces the remaining loan balance. Eligibility, available funding and refinancing conditions apply. Existing fixed-rate contracts retain their agreed rate. Revolving credit is not available.</p></section><section id="services"><span class="eyebrow">03 / TRANSPARENCY</span><h2>Services & taxes</h2><div class="service-grid"><article><h3>Monthly statements</h3><strong>Free</strong><p>Automatically archived PDF statements after month-end.</p></article><article><h3>Balance Guard</h3><strong>1.00 DM / month</strong><p>Published optional price per eligible account. Preference saving is available; protection and charging are not active yet.</p></article><article><h3>Tax policy</h3><strong>Not yet published</strong><p>VAT and account-tax rates await central configuration. No unconfirmed rate is presented as active.</p></article></div></section>${claimRatesSection()}<section class="document"><div><h2>Your tariff guide</h2><p>Generated from the bank catalogues on each build. Version ${version}. Package terms: ${BANK_VERSION}. Credit terms: ${CREDIT_VERSION}.</p><p class="fine">Catalogue references identify source terms, not a new effective date. Administrative rate editing and automatic downloadable PDF publication are planned. You can print or save this guide as PDF now.</p></div><button onclick="window.print()">Print / Save as PDF</button></section><p class="fine">No private account or transaction data is published here.</p></main><footer><a href="/">DuneRealms</a><a href="/rates-and-charges.html">Rates & Charges</a><a href="https://support.dunerealms.com/">Contact support</a></footer></body></html>`;
|
||||
}
|
||||
|
|
|
|||
5
website/scripts/claim-rates-section.mjs
Normal file
5
website/scripts/claim-rates-section.mjs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import {CLAIM_ORGANISATIONS,CLAIM_TARIFF_VERSION,claimTariffs,claimMoney} from '../control-panel/public/cp-v2/cp-v2-claim-tariffs.mjs';
|
||||
export function claimRatesSection(){
|
||||
const cards=Object.entries(CLAIM_ORGANISATIONS).map(([kind,group])=>`<article class="claim-rate-card claim-rate-${kind}"><header><h3>${group.name}</h3><p>${group.description}</p></header><div class="table-wrap" tabindex="0" role="region" aria-label="${group.name} claim tariffs"><table><caption>Per organisation · fictional DM</caption><thead><tr><th scope="col">Tier</th><th scope="col">Chunks</th><th scope="col">Monthly</th><th scope="col">Unlock</th></tr></thead><tbody>${claimTariffs(kind).map(row=>`<tr class="claim-stage-${row.stage.toLowerCase()}"><th scope="row">${row.code}${row.requirement?'<span class="claim-key-note">'+row.requirement+'</span>':''}</th><td>${row.chunks}</td><td>${claimMoney(row.upkeepMinor)}</td><td>${claimMoney(row.unlockMinor)}</td></tr>`).join('')}</tbody></table></div></article>`).join('');
|
||||
return `<section id="claims" class="claim-rates"><div class="claim-rates-heading"><img src="/assets/nav-clan-v2.webp" width="80" height="80" alt=""><div><span class="eyebrow">LAND / ORGANISATION CLAIMS</span><h2>Land claims & upkeep</h2><p>One organisation. One total chunk budget.</p></div></div><aside class="notice"><strong>Published schedule · claims system coming soon</strong><p>These are planned claim limits and prices. This publication does not reserve land, assign a tier, unlock an upgrade or start billing.</p></aside><div class="claim-rules"><article><h3>Count chunks, not radius</h3><p>One chunk is 16 × 16 blocks. Nine chunks in a 3 × 3 square cover 48 × 48 blocks. Limits apply across all claims belonging to the organisation.</p></article><article><h3>Separate status and capacity</h3><p>Create a Basic organisation first. Its original key unlocks Keyed status; a political appointment and new POL-key are required for Royal status. Tier unlock fees are paid once, sequentially. Upgrade claim capacity ingame by right-clicking the Home Block; this guide does not apply upgrades.</p></article><article><h3>Clear multipliers</h3><p>Companies: capacity × 1.5 and fees × 1.5. Protected Houses: capacity × 1.5 and fees × 0.5. Round capacity down to whole chunks. Both upkeep and unlock fees use the cost multiplier.</p></article></div><div class="claim-rates-grid">${cards}</div><p class="fine">Unlock calculation: 20 DM per additional chunk of standard clan capacity, plus ten months of the new standard tier’s upkeep; then apply the organisation cost multiplier. BC_T0 is free. Scaled fees are not recalculated from rounded capacity. Standard RC_T3 is 36 chunks: a possible 96 × 96-block square, fitting the agreed 100 × 100-block ceiling. Shapes may vary. Subhouses retain their own claim budget and account.</p><p class="fine">Schedule ${CLAIM_TARIFF_VERSION}. Print this page to include claim tariffs; the downloadable bank tariff PDF currently covers bank rates, not this planned claim schedule.</p></section>`;
|
||||
}
|
||||
15
website/tests/claim-tariffs.test.mjs
Normal file
15
website/tests/claim-tariffs.test.mjs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import test from 'node:test';import assert from 'node:assert/strict';
|
||||
import {claimTariffs} from '../control-panel/public/cp-v2/cp-v2-claim-tariffs.mjs';
|
||||
import {bankRatesPage} from '../scripts/bank-rates-page.mjs';
|
||||
test('agreed clan schedule, tier transitions and sequential unlock formula',()=>{
|
||||
const rows=claimTariffs();assert.deepEqual(rows.map(r=>r.chunks),[1,2,3,4,4,6,9,12,16,16,20,25,36]);
|
||||
assert.deepEqual(rows.map(r=>r.upkeepMinor),[0,200,400,600,500,800,1200,1600,2200,1800,2400,3000,4400]);
|
||||
assert.deepEqual(rows.map(r=>r.unlockMinor),[0,4000,6000,8000,5000,12000,18000,22000,30000,18000,32000,40000,66000]);
|
||||
assert.equal(rows.at(-1).chunks*16*16,96*96);assert.equal(rows[4].requirement,'CLAN-key');assert.match(rows[9].requirement,/POL-key/);
|
||||
});
|
||||
test('organisation scaling floors whole chunks and scales both costs without stacking or floating money',()=>{
|
||||
const clans=claimTariffs();for(const [kind,multiplier,prefix]of [['company',1.5,'BCO'],['protected',0.5,'PBC']]){const rows=claimTariffs(kind);assert.match(rows[0].code,new RegExp('^'+prefix));rows.forEach((row,i)=>{assert.equal(row.chunks,Math.floor(clans[i].chunks*1.5));assert.equal(row.upkeepMinor,clans[i].upkeepMinor*multiplier);assert.equal(row.unlockMinor,clans[i].unlockMinor*multiplier);assert(Number.isSafeInteger(row.upkeepMinor)&&Number.isSafeInteger(row.unlockMinor));});assert.equal(rows.at(-1).chunks,54);}assert.equal(claimTariffs('company')[4].requirement,'COM-key');assert.throws(()=>claimTariffs('administrator'));assert.equal(claimTariffs()[0].chunks,1);
|
||||
});
|
||||
test('public guide includes all 39 rows as a planned schedule and preserves banking tables',()=>{
|
||||
const html=bankRatesPage();for(const kind of ['clan','company','protected'])for(const row of claimTariffs(kind))assert(html.includes(row.code));assert.match(html,/id="claims"/);assert.match(html,/Published schedule · claims system coming soon/);assert.match(html,/16 × 16 blocks/);assert.match(html,/does not reserve land/);assert.match(html,/id="packages"/);assert.match(html,/id="credit"/);assert.match(html,/bank tariff PDF currently covers bank rates/);
|
||||
});
|
||||
|
|
@ -1 +1,2 @@
|
|||
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:#091f18;color:#e9eadb;font:16px/1.6 Arial,sans-serif}body>header,footer{padding:22px 5%;border-bottom:1px solid #756337}a{color:#e7cc88}main{max-width:1240px;margin:48px auto;padding:0 28px}.hero{display:flex;gap:48px;align-items:center;padding:54px;border:1px solid #b99a53;border-radius:24px;background:radial-gradient(at top left,#355540,#102e24 70%)}.hero img{width:260px;height:160px;object-fit:contain}.eyebrow{font-size:11px;letter-spacing:.2em;color:#c8af70}h1{font:54px/1.12 Georgia,serif;color:#f2da9d;margin:12px 0}h2{font:32px/1.3 Georgia,serif;color:#f2da9d;margin:10px 0}h3{font-size:18px;color:#ecd79e}.stamp{display:inline-block;border:1px solid #8c8158;border-radius:40px;padding:6px 14px;font-size:11px}.sections{display:flex;gap:12px;margin:24px 0}.sections a,button{border:1px solid #9f874f;border-radius:9px;padding:12px 20px;text-decoration:none;background:#19382c;color:#efdaa3;font-weight:bold}.notice{border-left:4px solid #c5aa64;background:#203c30;border-radius:8px;padding:20px 26px;margin:32px 0}.notice p{margin:5px 0}section[id]{margin:48px 0}.table-wrap{overflow:auto;border:1px solid #55765a;border-radius:14px}table{width:100%;border-collapse:collapse;font-size:14px;text-align:left}thead{background:#294e3d;color:#e2c77d}th,td{padding:17px 20px;border-bottom:1px solid #365342}tbody tr:last-child>*{border:0}tbody th{color:#f2e0b4}tbody tr:nth-child(even){background:#112e23}.fine{font-size:12px;color:#b6c9bc}.service-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.service-grid article{border:1px solid #597659;border-radius:14px;padding:24px;background:#153328}.service-grid strong{font:26px Georgia,serif;color:#abd8c4}.service-grid p{font-size:14px;color:#c2d0c4}.document{display:flex;align-items:center;gap:35px;padding:28px;border:1px solid #9f874f;border-radius:14px}.document p{font-size:13px}.document button{white-space:nowrap;cursor:pointer}footer{display:flex;gap:26px;margin-top:55px}@media print{body{background:white;color:#182d23}body>header,.sections,button,footer{display:none}main{margin:0;max-width:none}.hero{padding:20px}.hero img{width:170px;height:90px}h1{font-size:32px}h1,h2,h3,.fine{color:#263c2c}section[id]{margin:24px 0}th,td{padding:9px}section,article{break-inside:avoid}.service-grid{display:block}.service-grid article,.notice{background:white}.service-grid article{padding:8px}.document{padding:12px}}
|
||||
.sections{flex-wrap:wrap}.claim-rates-heading{display:flex;align-items:center;gap:22px;padding:24px;border:1px solid #9f874f;border-radius:16px;background:linear-gradient(100deg,#102d27f2,#102d27b0),url(/assets/political-imperial-chamber-v1.png) center/cover}.claim-rates-heading img{object-fit:contain}.claim-rules,.claim-rates-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.claim-rules{margin:24px 0}.claim-rules article,.claim-rate-card{min-width:0;border:1px solid #597659;border-radius:14px;background:#153328}.claim-rules article{padding:18px}.claim-rules p,.claim-rate-card header p{font-size:13px;color:#c2d0c4}.claim-rate-card header{padding:18px}.claim-rate-card h3{margin:0;color:#e7c879}.claim-rate-company h3{color:#9ad7e0}.claim-rate-protected h3{color:#d2b4e8}.claim-rate-card .table-wrap{border:0;border-radius:0 0 14px 14px}.claim-rate-card table{font-size:12px}.claim-rate-card th,.claim-rate-card td{padding:12px 8px;white-space:nowrap}.claim-rate-card caption{padding:8px;text-align:left;color:#bdcebf}.claim-key-note{display:block;max-width:115px;white-space:normal;font-size:10px;font-weight:normal;color:#bdcebf}@media(max-width:1050px){.claim-rates-grid{grid-template-columns:1fr}.claim-rate-card th,.claim-rate-card td{padding:13px 16px}.claim-rules{grid-template-columns:1fr}}@media(max-width:600px){main{padding:0 14px}.hero{padding:24px;gap:18px;flex-direction:column;align-items:flex-start}.hero img{width:160px;height:110px}h1{font-size:38px}.service-grid{grid-template-columns:1fr}.document{flex-direction:column;align-items:flex-start}.claim-rates-heading{padding:16px;gap:14px}.claim-rates-heading img{width:54px;height:54px}.claim-rates-heading h2{font-size:26px}.claim-rate-card th,.claim-rate-card td{padding:12px 8px}.sections a{flex:1;min-width:130px}footer{flex-wrap:wrap}}@media print{.claim-rates-grid{display:block}.claim-rate-card{margin:14px 0;break-inside:avoid}.claim-rules{display:block}.claim-rates-heading{background:white}.claim-rate-card table{font-size:11px}}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue

Staff