forked from unimatrix/web
Merge pull request 'Shared Missions & Decisions design for the Realm CPs' (#406) from feature/missions-decisions-design-20261118 into main
This commit is contained in:
commit
dd2293396a
30 changed files with 1183 additions and 33 deletions
33
docs/design/MISSIONS-DECISIONS-DESIGN-BATCH.md
Normal file
33
docs/design/MISSIONS-DECISIONS-DESIGN-BATCH.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Missions & Decisions — approved design batch
|
||||
|
||||
18 November 2026. Design publication authorised. Backend begins only after live design acceptance.
|
||||
|
||||
- Existing header and footer remain shared. My Account: User CP, Mail, Imperial Postbank, Rihla Transfers, Quest Dashboard. Profile and Account Security remain inside User CP.
|
||||
- The central Quest Dashboard alone shows Personal / Clan / Company / Politics context tabs.
|
||||
- Each CP integrates Missions / Decisions / History directly in its own context, with its roster, avatars and palette.
|
||||
- Emperor: large decorative court gallery, fixed political House seals and leader portraits. These are decoration, not electoral controls. Other offices, clans and companies reuse the gallery with their own rosters and less ceremonial artwork.
|
||||
- Elections remain in their existing workspace, not embedded in the decision page.
|
||||
- Personal design catalogue includes all nine handover branches, Q0 repair immediately after obtaining the faction kit, and a spoiler-free optional discovery placeholder.
|
||||
- Political catalogue includes all 63 v2.2 decisions. DuneRealms display names take precedence over Dune reference names. Imperial Steward Water/Spice rights must remain available through their existing implementation.
|
||||
- No XP, rewards, authority, economic charges or game effects are enabled by this design. All actions remain explicitly pending integration.
|
||||
- Only major level milestones publish: halfway and completion of the configured seasonal cap (proposed S1 35 and 70). Once per player/season/milestone, reuse the existing publication outbox. Completion follows validated completion-key execution, halfway follows verified threshold crossing, never code generation.
|
||||
- Website is primary. Future Minecraft quest scoreboard reads central state through the API; no second gameplay or quest engine. Only necessary gameplay events/item delivery need an adapter later. No Minecraft changes in this batch.
|
||||
- Keep old reference CPs during design review. Retire obsolete reference routes only after acceptance of the replacement.
|
||||
- After publication the user tests with the DuneRealms account. On the user's signal, temporarily move that account to the next POL House leadership and restore previous occupants afterward. Do not change the user's Emperor office or sign into the DuneRealms account.
|
||||
|
||||
## Integration contract for the backend batch
|
||||
|
||||
The design catalogue is presentation-only. The backend must map stable mission/decision definition IDs to the existing J.A.R.V.I.S. instrument lifecycle. Read models supply current scope, authenticated authority, immutable quest reference, prerequisites, counters, claimed rewards, expiry, XP/level, season and history. Authority is revalidated at execution. Claim and execute operations require one idempotent execution reference and return the existing dossier/delivery state. Never derive authority or payouts from the browser catalogue.
|
||||
|
||||
Currency in the source handover is Solari; operational accounts use DM. Resolve the canonical accounting label before enabling costs. Council rejection of peace and existing homeworld warfare remain independent of supplemental XP level gates.
|
||||
|
||||
## Artwork
|
||||
|
||||
Built-in image generation produced two reusable background illustrations, compressed to WebP: progression/imperial-court.webp and progression/repair-workshop.webp. Court prompt: ceremonial voxel imperial hall, burgundy banners, gold columns, empty throne and room for separately rendered avatars/seals, no text/UI. Repair prompt: voxel workshop, worn tools and four repair components, lantern lighting, no text/UI. Existing separate heraldic seals and item artwork remain reused. Full UI concept screenshots are not used as page backgrounds.
|
||||
|
||||
## Following backend acceptance
|
||||
Perform a website-wide design consistency pass: buttons, colours, spacing, typography, tables and forms. Preserve deliberate CP themes; eliminate accidental mismatches. This follows the backend batch, not this design publication.
|
||||
|
||||
|
||||
## Official identities
|
||||
Jarvis receives original DuneRealms archivist lore, a dedicated avatar and clearly ceremonial company props; do not create a company or valid keys for those props. Requested permanent Emperor POL-clan archive membership must use the existing staff-key mechanism, not an officeholder term or AD rank. Keep the Emperor office unchanged. Preserve Patrick memorial identity without login/AD. Verify separate least-privilege Git collaboration and forum publication access for Jarvis; no broad staff permissions are implied.
|
||||
|
|
@ -27,12 +27,13 @@ export function createDeedCard({clan,deed,titles,established}){
|
|||
export function createOrganisationPortraitTree(organisation,{kind='company'}={}){
|
||||
styles();const politics=kind==='politics',root=el('section',undefined,'clan-dynasty organisation-portrait-tree'),heading=el('header'),shield=el('div',undefined,'dynasty-heraldic-shield'),crest=el('img');crest.src=organisation.emblem;crest.alt=organisation.name+' emblem';shield.append(crest);heading.append(shield,el('small',politics?'OFFICE & DELEGATIONS':'BOARD & REPRESENTATIVES'),el('h2',organisation.name));root.append(heading);
|
||||
const groups=[{title:politics?'Office holder':'Company leadership',rows:[]},{title:politics?'Office council':'Board & representatives',rows:[]},{title:'Liaisons & observers',rows:[]}];
|
||||
for(const member of organisation.members||[]){const owner=member.role==='officeholder'||member.username===organisation.owner_username,observer=member.role==='observer'||String(member.appointmentType||'').includes('liaison');groups[owner?0:observer?2:1].rows.push(member);}
|
||||
const members=[...(organisation.members||[])];if(organisation.owner_username&&!members.some(member=>member.username?.toLowerCase()===organisation.owner_username.toLowerCase()))members.unshift({username:organisation.owner_username,name:organisation.owner_name||organisation.owner_username,title:politics?'Office holder':'Registered deed owner',role:politics?'officeholder':'owner',memorial:organisation.owner_memorial});
|
||||
for(const member of members){const owner=member.role==='officeholder'||member.username?.toLowerCase()===organisation.owner_username?.toLowerCase(),observer=member.role==='observer'||String(member.appointmentType||'').includes('liaison');groups[owner?0:observer?2:1].rows.push(member);}
|
||||
for(const [index,group]of groups.entries()){
|
||||
if(index===2&&!politics&&!group.rows.length)continue;
|
||||
const section=el('section',undefined,'dynasty-interior '+(index===0?'dynasty-family':'dynasty-council')),grid=el('div',undefined,'dynasty-council-grid');section.append(el('h3',group.title));
|
||||
if(!group.rows.length)grid.append(el('p',index===0?'Position vacant.':'No current appointments.'));
|
||||
for(const member of group.rows){const card=el('article',undefined,'dynasty-player'),portrait=el('div',undefined,'dynasty-portrait'),face=el('img'),link=el('a',member.name||member.username);face.src='https://cp.dunerealms.com/api/avatars/face/roster/'+encodeURIComponent(member.username);face.alt=member.username+' Minecraft portrait';face.width=face.height=96;face.loading='lazy';portrait.append(face);link.href='https://www.dunerealms.com/people/'+encodeURIComponent(member.username);card.append(el('small',member.title||member.role||'Member'),portrait,link,el('small','@'+member.username));if(member.expiresAt)card.append(el('small','Term ends '+new Date(member.expiresAt).toLocaleDateString('en-GB')));grid.append(card);}section.append(grid);root.append(section);
|
||||
for(const member of group.rows){const card=el('article',undefined,'dynasty-player'),portrait=el('div',undefined,'dynasty-portrait'),face=el('img'),link=el('a',member.name||member.username);face.src='https://cp.dunerealms.com/api/avatars/face/roster/'+encodeURIComponent(member.username);face.alt=member.username+' Minecraft portrait';face.width=face.height=96;face.loading='lazy';portrait.append(face);link.href='https://www.dunerealms.com/'+(member.memorial?'memorial/'+encodeURIComponent(member.memorial):'people/'+encodeURIComponent(member.username));card.append(el('small',member.title||member.role||'Member'),portrait,link,el('small','@'+member.username));if(member.expiresAt)card.append(el('small','Term ends '+new Date(member.expiresAt).toLocaleDateString('en-GB')));grid.append(card);}section.append(grid);root.append(section);
|
||||
}
|
||||
root.dataset.structure=politics?'office-deeds':'company-board';return root;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import {mountProgressionDesign} from './cp-v2-progression.mjs';
|
||||
import {showInvalidKey} from './cp-v2-key-validation.mjs';
|
||||
import {createJarvisRegister} from './cp-v2-jarvis-register.mjs';
|
||||
import {organisationTabs} from '../organisation-tabs.mjs';
|
||||
|
|
@ -25,6 +26,7 @@ export function mountCodexManagement(host,{initial='keys',fetcher=fetch}={}){
|
|||
const listings=box('Listings & distribution','One exchange for goods and eligible J.A.R.V.I.S. instruments. Listings retain the record owner and instance reference.');listings.append(empty(['Listing','Type','Owner','Audience','State'],'Listing administration adapter pending.'),locked('Manage listing · service adapter pending'));retained(listings,'Open existing exchange controls','./cp-v2-exchange-authority.mjs','mountExchangeAuthority');groups.push({id:'listings',title:'Listings',content:listings});
|
||||
const history=box('History','Issuance, replacements, transfers, redemption and delivery attempts are recorded without exposing private key material.');history.append(field('Search history','Instance, issuer, recipient or decision'),empty(['Time','Instrument','Action','Actor','Reason','Result'],'Audit service not connected.'));groups.push({id:'history',title:'History',content:history});
|
||||
const seasons=box('Seasons & signing keys','Each season or isolated test run has its own signing-key version. Existing deeds and historical items retain their origin.');seasons.append(table(['Policy','Behaviour'],[['Origin','Season, Alpha/Beta/Live stage, release version and issue date stay attached to the instance.'],['Historical originals','Staff regeneration creates a new current-version instance; it never relabels the historical original.'],['Quality','Common, Uncommon, Rare, Very Rare and Legendary describe quality independently from edition age and actual scarcity.'],['Carry-over','Deeds persist. Unused older-season keys and rare items remain valid and transferable when their type permits.'],['Key rotation','New issues use the active signing key; historical signatures remain verifiable.'],['Test isolation','Test-run instances belong to their own namespace and cannot be redeemed in production.'],['Duplicate protection','Validate on use, redemption or transfer; atomic processing accepts an instance only once.']]),locked('Rotate active signing key'),locked('Create isolated test run'));groups.push({id:'seasons',title:'Seasons',content:seasons});
|
||||
const progression=box('Missions, decisions & progression','Design catalogue · definitions are not executable yet.'),progressionHost=make('div');progression.append(progressionHost);disposers.push(mountProgressionDesign(progressionHost,{manage:true,context:'politics'}));groups.push({id:'progression',title:'Missions & decisions',content:progression});
|
||||
const validator=box('Check a key','Read-only inspection. Checking never activates or consumes a key.'),checkForm=make('form'),checkInput=make('input'),checkButton=make('button','Check key'),checkResult=make('div');checkInput.type='password';checkInput.autocomplete='off';checkInput.maxLength=300;checkInput.required=true;checkInput.setAttribute('aria-label','Private key to validate');checkButton.type='submit';checkForm.append(checkInput,checkButton);validator.append(checkForm,checkResult);groups.find(g=>g.id==='keys').content.append(validator);checkForm.onsubmit=async event=>{event.preventDefault();if(checkButton.disabled)return;checkButton.disabled=true;try{const r=await fetcher('/api/jarvis/validate',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json'},body:JSON.stringify({code:checkInput.value,staff:true})}),data=await r.json();if(!r.ok)throw Error(data.message||'Validation unavailable');if(data.state==='invalid')showInvalidKey(checkResult,'Key rejected. Dev support: '+(data.ticketNumber||data.caseId||'pending'));else checkResult.textContent=data.valid?'Recognised · '+data.state+' · no key consumed.':'This key type cannot be checked by the connected service.';}catch(e){checkResult.textContent=e.message;}finally{checkInput.value='';checkButton.disabled=false;}};
|
||||
const registers=new Map();for(const [tab,section] of [['keys','keys'],['keys','deeds'],['listings','listings'],['history','history'],['delivery','delivery'],['seasons','seasons']]){const register=createJarvisRegister(section,{fetcher}),group=groups.find(g=>g.id===tab);if(['listings','history','delivery'].includes(tab))group.content.querySelector('.codex-table-scroll')?.remove();if(tab==='history')group.content.querySelector('.codex-field')?.remove();if(tab==='delivery'){const filter=group.content.querySelector('select');if(filter)filter.disabled=true;}const frame=box(section==='deeds'?'Office deeds':'Live '+section+' register');frame.append(register.root);group.content.append(frame);if(!registers.has(tab))registers.set(tab,[]);registers.get(tab).push(register);disposers.push(register.dispose);}const tabs=organisationTabs(groups,{label:'J.A.R.V.I.S. Management sections',initial});tabs.addEventListener('organisation-tab-change',event=>{for(const item of registers.get(event.detail.id)||[])item.load();});root.append(tabs);for(const item of registers.get(initial)||[])item.load();host.replaceChildren(root);return()=>{mounted=false;for(const dispose of disposers)if(typeof dispose==='function')dispose();root.remove();};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import {element as el,createCPV2Page} from './cp-v2-page-template.mjs';import {c
|
|||
const colors={server:'#927123',clan:'#28714d',company:'#245e82',politics:'#74325e',atreides:'#28714d',harkonnen:'#a43c38',corrino:'#927123',ordos:'#386d8d',fremen:'#a36327',veiled_concord:'#74325e',spacing_guild:'#277b83'};
|
||||
export function mountRealmEvents(host,{kind=null,scopeId=null,fetcher=fetch}={}){
|
||||
electionDesignStyles();let active=true,calendar=null,rows=[],canManage=false,busy=false,editing=null,pending=null;const controller=new AbortController(),api=createUserAPI(fetcher,controller.signal),calendarHost=el('div'),manage=el('section',undefined,'election-panel'),create=el('section',undefined,'election-panel'),status=el('p','Opening J.A.R.V.I.S. events…'),scope=el('select'),legend=el('p'),details=el('section',undefined,'election-panel');status.setAttribute('role','status');for(const [id,label]of [['','All events'],['server','Server'],['clan','Clan'],['company','Company'],['politics','Politics / faction']]){const option=el('option',label);option.value=id;scope.append(option);}scope.setAttribute('aria-label','Filter events');legend.append(el('span','Server · gold | Clan · green | Company · blue | Politics · faction colours'));const calendarPanel=el('section');calendarPanel.append(scope,legend,calendarHost,details);
|
||||
const form=el('form',undefined,'organisation-settings-form'),title=el('input'),description=el('textarea'),start=el('input'),end=el('input'),check=el('input'),save=el('button','Publish event'),feedback=el('p');title.maxLength=100;title.minLength=3;title.required=true;description.maxLength=2000;start.type=end.type='datetime-local';start.required=end.required=true;check.type='checkbox';check.required=true;for(const [name,input]of [['Title',title],['Description',description],['Starts · UTC',start],['Ends · UTC',end],['I confirm this event publication.',check]]){const label=el('label',name);label.append(input);form.append(label);}save.type='submit';form.append(save,feedback);const promotion=el('fieldset');promotion.append(el('legend','Promotion'));for(const name of ['Boards','Discord']){const label=el('label',name),input=el('input');input.type='checkbox';input.disabled=true;label.prepend(input);promotion.append(label);}promotion.append(el('p','Promotion delivery is not configured yet. No fee or credit is charged.'));form.append(promotion);create.append(el('h3','Create event'),form);const {root,activate}=createCPV2Page({shellHost:host,title:'Events',description:'Shared calendar and J.A.R.V.I.S. event instruments.',artwork:'nav-home-v2.webp',tabs:[{id:'calendar',label:'Calendar',content:calendarPanel},{id:'manage',label:'Manage Events',content:manage},{id:'create',label:'Create Event',content:create}],onActivate:id=>{if(id==='calendar')requestAnimationFrame(()=>calendar?.updateSize());}});root.prepend(status);host.replaceChildren(root);
|
||||
const form=el('form',undefined,'organisation-settings-form'),title=el('input'),description=el('textarea'),start=el('input'),end=el('input'),check=el('input'),save=el('button','Publish event'),feedback=el('p');title.maxLength=100;title.minLength=3;title.required=true;description.maxLength=2000;start.type=end.type='datetime-local';start.required=end.required=true;check.type='checkbox';check.required=true;for(const [name,input]of [['Title',title],['Description',description],['Starts · UTC',start],['Ends · UTC',end],['I confirm this event publication.',check]]){const label=el('label',name);label.append(input);form.append(label);}save.type='submit';form.append(save,feedback);const promotion=el('fieldset');promotion.append(el('legend','Promotion'));for(const name of ['Boards','Discord']){const label=el('label',name),input=el('input');input.type='checkbox';input.disabled=true;label.prepend(input);promotion.append(label);}promotion.append(el('p','Promotion delivery is not configured yet. No fee or credit is charged.'));promotion.hidden=kind==='server';form.append(promotion);if(kind==='server')form.append(el('p','Public server events use automatic Discord announcements when delivery is available. Updates and cancellation use the same announcement.'));create.append(el('h3','Create event'),form);const {root,activate}=createCPV2Page({shellHost:host,title:'Events',description:'Shared calendar and J.A.R.V.I.S. event instruments.',artwork:'nav-home-v2.webp',tabs:[{id:'calendar',label:'Calendar',content:calendarPanel},{id:'manage',label:'Manage Events',content:manage},{id:'create',label:'Create Event',content:create}],onActivate:id=>{if(id==='calendar')requestAnimationFrame(()=>calendar?.updateSize());}});root.prepend(status);host.replaceChildren(root);
|
||||
const local=n=>new Date(n).toISOString().slice(0,16);function eventData(){return rows.filter(r=>r.state==='scheduled'&&(!scope.value||r.kind===scope.value)).map(r=>({id:r.id,title:r.title,start:new Date(r.startsAt).toISOString(),end:new Date(r.endsAt).toISOString(),backgroundColor:colors[r.scopeId]||colors[r.kind],borderColor:colors[r.scopeId]||colors[r.kind]}));}function draw(){if(calendar){calendar.removeAllEvents();calendar.addEventSource(eventData());}manage.replaceChildren(el('h3','Your event instruments'));if(!canManage){manage.append(el('p','A current organisation deed or staff authority is required to manage these events.'));}else for(const row of rows){const card=el('article',undefined,'election-panel');card.append(el('h4',row.title),el('code',row.reference),el('p',row.state+' · '+new Date(row.startsAt).toLocaleString('en-GB',{timeZone:'UTC'})+' UTC'));if(row.state==='scheduled'){const edit=el('button','Edit'),cancel=el('button','Delete event');edit.type=cancel.type='button';edit.onclick=()=>{editing=row;pending=null;title.value=row.title;description.value=row.description;start.value=local(row.startsAt);end.value=local(row.endsAt);check.checked=false;save.textContent='Save changes';activate('create');};cancel.onclick=async()=>{if(busy||!confirm('Remove this event from the calendar? The audit record will remain.'))return;busy=true;try{await api.request('/api/jarvis/events',{...row,scopeId:row.scopeId,action:'cancel',requestId:crypto.randomUUID(),confirmed:true});await load();}catch(e){status.textContent=e.message;}finally{busy=false;}};card.append(edit,cancel);}manage.append(card);}if(canManage&&!rows.length)manage.append(el('p','No events in this register.'));for(const field of form.elements)if(field!==promotion&&!promotion.contains(field))field.disabled=!canManage;}
|
||||
async function load(){try{if(kind==='clan'&&!scopeId){const clans=await api.request('/api/clans');scopeId=clans.membership?.clan_id||null;}const query=kind&&scopeId?'?'+new URLSearchParams({kind,id:scopeId}):'';const data=await api.request('/api/jarvis/events'+query);if(!active)return;rows=data.events;canManage=!!data.canManage;status.textContent=rows.length?'J.A.R.V.I.S. event register · times shown in UTC.':'No published events in this calendar.';draw();}catch(e){if(active){status.textContent=e.message;canManage=false;draw();}}}
|
||||
scope.onchange=draw;form.onsubmit=async e=>{e.preventDefault();if(busy||!canManage||!form.reportValidity())return;pending||={action:editing?'update':'create',kind,scopeId,requestId:crypto.randomUUID(),...(editing?{id:editing.id,revision:editing.revision}:{}),title:title.value,description:description.value,startsAt:Date.parse(start.value+'Z'),endsAt:Date.parse(end.value+'Z'),confirmed:check.checked};busy=true;save.disabled=true;try{await api.request('/api/jarvis/events',pending);if(!active)return;pending=null;editing=null;form.reset();save.textContent='Publish event';feedback.textContent='Event saved.';await load();activate('manage');}catch(error){feedback.textContent=error.message;if(error.uncertain){for(const field of form.elements)field.disabled=true;feedback.textContent+=' Reload the page to verify the register before retrying.';}else pending=null;}finally{busy=false;if(active&&!pending)save.disabled=!canManage;}};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export const ORGANISATION_MENU_GROUPS=Object.freeze([
|
||||
['Your organisation',[['overview','Dashboard'],['settings','Settings']]],
|
||||
['Your organisation',[['overview','Dashboard'],['settings','Settings'],['missions','Missions & Decisions']]],
|
||||
['Organisation affairs',[['boards','Boards'],['events','Events'],['elections','Elections'],['naibs','Council of Naibs'],['advertising','Advertising'],['commerce','Exchange'],['jobs','Office vacancies'],['tailor','Tailor']]],
|
||||
['Estates & relations',[['claims','Claims'],['subsidiaries','Subhouses'],['directory','Directory'],['projects','Expeditions'],['campaigns','Campaigns']]]
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -6,3 +6,16 @@
|
|||
.organisation-settings-form{display:grid;gap:16px;margin-top:20px}.organisation-settings-form label{display:grid;gap:8px}.organisation-settings-form input,.organisation-settings-form textarea{box-sizing:border-box;max-width:100%;width:100%;padding:12px;border:1px solid #7d8b60;border-radius:8px;background:#102b25;color:#eadfbf;font:inherit}.organisation-settings-form textarea{min-height:150px;resize:vertical}.organisation-settings-form button{justify-self:start;padding:12px 20px;border:1px solid #bda05c;border-radius:8px;background:#203f39;color:#f1d99a;cursor:pointer}.organisation-settings-form button:disabled{opacity:.5}
|
||||
/* One organisation layout, with the established Company and Political palettes. */
|
||||
.organisation-sidebar-switcher{display:grid!important;justify-items:center;gap:12px;margin:18px 0;padding:18px 10px!important;border:1px solid #b99a51;border-radius:8px;background:transparent!important;box-sizing:border-box}.organisation-sidebar-switcher>img{width:74px;height:74px;object-fit:contain}.organisation-sidebar-switcher label{display:grid;gap:10px;width:100%;font-size:15px;text-align:center}.organisation-sidebar-switcher select{width:100%!important;min-width:0!important;max-width:100%;box-sizing:border-box;font-size:14px}.company-cp-shell .organisation-workspace-hero{background:linear-gradient(90deg,#153d4bee,#102832aa),url('https://www.dunerealms.com/assets/political-imperial-chamber-v1.png') center/cover}.company-cp-shell .organisation-settings-card{background:#15323c;color:#eee4ca;border-color:#a58b52}.company-cp-shell .organisation-settings-card h3{color:#efd49b}.politics-cp-shell .organisation-portal{background:linear-gradient(145deg,#fff5df,#e4cfaa);color:#632f2c;box-shadow:inset 0 0 0 3px #f6ecd8}.politics-cp-shell .organisation-portal[aria-current=page]{background:linear-gradient(135deg,#783d43,#3c1b21);color:#ffedc5}.politics-cp-shell .organisation-workspace-hero{background:linear-gradient(90deg,#632c35ed,#3c1b2177),url('https://www.dunerealms.com/assets/political-imperial-chamber-v1.png') center/cover}.politics-cp-shell .organisation-settings-card{background:#fff8eb;color:#38271f;border-color:#b89756}.politics-cp-shell .organisation-settings-card h3{color:#632f2c}.politics-cp-shell .organisation-settings-form input,.politics-cp-shell .organisation-settings-form textarea{background:#f6ecda;color:#38271f;border-color:#aa8755}.politics-cp-shell .cp-v2-template-tabs{display:flex}.politics-cp-shell .cp-v2-template-tab{background:#f6ecda;color:#632f2c}.politics-cp-shell .cp-v2-template-tab[aria-selected=true]{background:#6b343b;color:#ffedc5}.politics-cp-shell .organisation-sidebar-switcher{color:#632f2c}
|
||||
/* Complete organisation themes. The outer shared website header/footer are unchanged. */
|
||||
body.politics-cp-shell{--cp-surface:#2b1423;--cp-raised:#432236;--cp-deep:#1c0e18;--cp-copy:#efe0c8;--cp-trim:#b89a58;background:var(--cp-deep);color:var(--cp-copy)}
|
||||
body.company-cp-shell{--cp-surface:#142b38;--cp-raised:#1d3a49;--cp-deep:#0c1d29;--cp-copy:#e2e7dd;--cp-trim:#b89a58;background:var(--cp-deep);color:var(--cp-copy)}
|
||||
:is(.politics-cp-shell,.company-cp-shell) :is(#content,#sidebar,#sidebar-right,#portals,.cards,.card,.category-block,.category-heading,.category-links,.organisation-portals,.organisation-switcher,.organisation-settings-card,.organisation-settings-form,.cp-v2-template-panel,.cp-v2-template-tabs,.cp-v2-template-tab,.organisation-dashboard,.organisation-dashboard-card,.organisation-tab-panel,.organisation-tab-button,.codex-management-box,.codex-preview-notice){background-color:var(--cp-surface);color:var(--cp-copy);border-color:var(--cp-trim)}
|
||||
:is(.politics-cp-shell,.company-cp-shell) :is(.organisation-settings-card,.organisation-portal,.category-heading,.cp-v2-template-tab,.organisation-tab-button){background:linear-gradient(135deg,var(--cp-raised),var(--cp-surface));color:var(--cp-copy);box-shadow:inset 0 0 0 2px var(--cp-deep)}
|
||||
:is(.politics-cp-shell,.company-cp-shell) :is(input,select,textarea,button,.navitem){background-color:var(--cp-deep);color:var(--cp-copy);border-color:var(--cp-trim)}
|
||||
:is(.politics-cp-shell,.company-cp-shell) :is(h1,h2,h3,h4,strong,label,legend,a){color:#efd6a0}
|
||||
:is(.politics-cp-shell,.company-cp-shell) :is(.organisation-settings-card h3,.organisation-sidebar-switcher,.organisation-portal){color:#efd6a0}
|
||||
:is(.politics-cp-shell,.company-cp-shell) :is(th,td){border-color:#a38b564d;color:var(--cp-copy)}
|
||||
:is(.politics-cp-shell,.company-cp-shell) th{background:var(--cp-raised)}
|
||||
.politics-cp-shell .organisation-workspace-hero{background:linear-gradient(90deg,#35142bea,#25102088),url('https://www.dunerealms.com/assets/progression/imperial-court.webp') center/cover}
|
||||
.company-cp-shell .organisation-workspace-hero{background:linear-gradient(90deg,#123542ec,#10273777),url('https://www.dunerealms.com/assets/exchange-starport-header-v2.webp') center/cover}
|
||||
:is(.politics-cp-shell,.company-cp-shell) .organisation-portal{min-height:110px;padding:12px;gap:6px;text-align:center;font-size:18px}.organisation-portal img{width:84px;height:84px}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import {mountProgressionDesign} from './cp-v2-progression.mjs';
|
||||
import {mountNaibCouncil} from './cp-v2-naib-council.mjs';
|
||||
import {mountPoliticalJobs} from './cp-v2-political-jobs.mjs';
|
||||
import {mountRealmEvents} from './cp-v2-events.mjs';
|
||||
|
|
@ -33,11 +34,12 @@ export function startOrganisationCP(kind){
|
|||
function pending(host,title,copy){const box=el('section',undefined,'organisation-settings-card');box.append(el('h3',title),el('p',copy));host.append(box);}
|
||||
function render(){
|
||||
if(!ready||stopped)return;dispose();dispose=()=>{};const turn=++generation,record=records.find(r=>r.id===selected),page=route()||'overview';
|
||||
left.replaceChildren(el('div',company?'YOUR COMPANY':'YOUR POLITICAL HOUSE','side-hero'));right.replaceChildren(el('div',company?'COMPANY DIRECTORY':'POLITICAL HOUSES','side-hero'));portals.replaceChildren();portals.hidden=false;portals.classList.remove('organisation-switcher');const tiles=el('div',undefined,'organisation-portals');for(const [id,title,art,href] of [['overview',company?'My Company':'My Political House',record?.emblem||fallback],['quests','Quests','nav-manual-v2.webp','https://www.dunerealms.com/exchange.html?type=quests'],['tailor','Kits',company?'minecraft-items/iron_pickaxe.png':'items/office_water.png','https://www.dunerealms.com/exchange.html?type=kits-'+(company?'clan':'office')],['campaigns','Events',company?'nav-home-v2.webp':'seals/emperor-v1.png']]){const a=el('a',undefined,'organisation-portal');a.href=href||'#'+prefix+'/'+id;if(href)a.target='_top';a.append(image(art),el('strong',title));if(id===page)a.setAttribute('aria-current','page');tiles.append(a);}portals.append(tiles);
|
||||
left.replaceChildren(el('div',company?'YOUR COMPANY':'YOUR POLITICAL HOUSE','side-hero'));right.replaceChildren(el('div',company?'COMPANY DIRECTORY':'POLITICAL HOUSES','side-hero'));portals.replaceChildren();portals.hidden=false;portals.classList.remove('organisation-switcher');const tiles=el('div',undefined,'organisation-portals');for(const [id,title,art,href] of [['overview',company?'My Company':'My Political House',record?.emblem||fallback],['missions','Missions & Decisions','nav-manual-v2.webp'],['tailor','Kits',company?'minecraft-items/iron_pickaxe.png':'items/office_water.png','https://www.dunerealms.com/exchange.html?type=kits-'+(company?'clan':'office')],['campaigns','Events',company?'nav-home-v2.webp':'seals/emperor-v1.png']]){const a=el('a',undefined,'organisation-portal');a.href=href||'#'+prefix+'/'+id;if(href)a.target='_top';a.append(image(art),el('strong',title));if(id===page)a.setAttribute('aria-current','page');tiles.append(a);}portals.append(tiles);
|
||||
const label=el('label',company?'Your companies':'Political Houses'),select=el('select');select.setAttribute('aria-label',company?'Choose your company':'Choose a political House');for(const r of records){const option=el('option',r.name);option.value=r.id;select.append(option);}if(!records.length){const option=el('option','No verified organisation available');option.value='';select.append(option);}select.value=selected||'';select.disabled=!records.length;select.onchange=()=>{selected=select.value;const u=new URL(location.href);u.searchParams.set(company?'company':'office',selected);history.replaceState(null,'',u);render();};label.append(select);const selector=el('div',undefined,'organisation-switcher');selector.append(image(record?.emblem||fallback),label);selector.classList.add('organisation-sidebar-switcher');
|
||||
for(let i=0;i<groups.length;i++){const [heading,items]=groups[i],host=i<2?left:right,block=el('section',undefined,'category-block'),links=el('div',undefined,'category-links');block.append(el('div',heading,'category-heading'));for(const[id,title]of items){if(company&&['jobs','naibs'].includes(id))continue;const a=el('a',title==='Subhouses'&&company?'Subsidiaries':title,'navitem');a.href='#'+prefix+'/'+id;a.dataset.menuHref=(company?outer+'/':outer+'/government.html')+a.getAttribute('href');if(id===page)a.setAttribute('aria-current','page');links.append(a);}block.append(links);host.append(block);}left.append(selector);
|
||||
const hero=el('header',undefined,'hero organisation-workspace-hero'),copy=el('div');copy.append(el('small',company?'SPACING GUILD · COMMERCIAL AFFAIRS':'IMPERIAL HOUSES · OFFICE DEEDS'),el('h1',record?.name||noun+' Dashboard'),el('p',company?'Your enterprise, its people and its next chapter.':'Protected Houses · membership follows current office deeds.'));hero.append(image(record?.emblem||fallback),copy);
|
||||
const cards=el('div',undefined,'cards'),card=el('article',undefined,'card full citizen-page-full'),host=el('div',undefined,'citizen-live-host clan-center');card.append(host);cards.append(card);content.replaceChildren(hero,cards);
|
||||
if(page==='missions'){dispose=mountProgressionDesign(host,{context:kind,organisation:record,members:record?.members||[],office:record?.id==='emperor'?'IMP':({atreides:'ATR',harkonnen:'HAR',corrino:'COR',ordos:'ORD',fremen:'FRE',bene:'BG',guild:'SG',veiled_concord:'BG',spacing_guild:'SG',arrakis:'FRE',clan_delegate:'CLD'})[record?.id]||'IMP'});return;}
|
||||
if(page==='events'){dispose=mountRealmEvents(host,{kind,scopeId:record.id});return;}
|
||||
if(page==='naibs'&&!company){dispose=mountNaibCouncil(host);return;}
|
||||
if(page==='elections'){dispose=mountElectionDesign(host,{context:company?'company':'citizen'});return;}
|
||||
|
|
@ -58,7 +60,7 @@ export function startOrganisationCP(kind){
|
|||
}else if(page==='mail'&&company){const frame=el('iframe');frame.title=record.name+' correspondence';frame.src='/user-service.html?service=inbox&company='+encodeURIComponent(record.id)+'#company-inbox';frame.style.cssText='width:100%;min-height:900px;border:0';host.append(frame);
|
||||
}else if(page==='mail'&&!company){if(record.membership&&record.mailScope)dispose=mountNativeService(host,'post-mail',{singleHeading:true,title:record.name+' · Office mail',folder:'INBOX',initialTab:record.mailScope==='imperial'?'imperial-inbox':'faction-inbox'});else host.append(el('p','An authorised current office deed is required to open this office mailbox.'));}else if(page==='claims'){dispose=mountClaims(host,{kind:company?'company':'protected',name:record.name,companyId:company?record.id:null,protectedId:company?null:record.claimOrganisationId});}
|
||||
else if(page==='boards'){if(company)dispose=mountNativeService(host,'company-boards',{singleHeading:true,organisationId:record.id});else dispose=mountNativeService(host,'election-boards',{singleHeading:true});}
|
||||
|
||||
|
||||
else if(!company&&page==='campaigns')dispose=mountPoliticsPage(host,'house-elections');
|
||||
else if(page==='commerce'){dispose=mountExchangeDesign(host,{context:'clan',organisationScope:{kind,id:record.id}});}
|
||||
else if(company&&page==='subsidiaries'){const box=el('section',undefined,'organisation-settings-card');box.append(el('h3','Company hierarchy'),el('p','Registered parent and subsidiary companies.'));for(const relation of record.relations||[]){const row=el('article',undefined,'organisation-office-member'),logo=image(relation.emblem);logo.width=logo.height=64;const copy=el('div'),link=el('a',relation.name);link.href=relation.url;link.target='_top';copy.append(link,el('p',relation.direction==='parent'?'Parent company':'Subsidiary · '+(({created:'Founded',purchased:'Purchased',conquered:'Acquired'})[relation.origin]||'Registered')));row.append(logo,copy);box.append(row);}if(!record.relations?.length)box.append(el('p','No parent or subsidiary company is registered.'));host.append(box);dispose=mountCompanySubsidiary(host,{record,onCreated:id=>{const url=new URL(location.href);url.searchParams.set('company',id);url.hash='company/overview';location.assign(url.href);}});}
|
||||
|
|
@ -72,4 +74,3 @@ export function startOrganisationCP(kind){
|
|||
window.addEventListener('pagehide',()=>{stopped=true;generation++;dispose();observer.disconnect();window.removeEventListener('hashchange',onRoute);window.removeEventListener('message',onMeasure);},{once:true});
|
||||
startCPAuthentication(async account=>{user=account;if(!user.permissions?.includes('web.menu.game')){content.replaceChildren(el('p','Game account access is required.'));return;}const id=new URL(location.href).searchParams.get(company?'company':'office');try{const response=await fetch(company?'/api/companies/workspace'+(id?'?company='+encodeURIComponent(id):''):'/api/politics/workspace'+(id?'?office='+encodeURIComponent(id):''),{credentials:'same-origin',cache:'no-store'}),data=await response.json();if(!response.ok)throw Error(data.message||'Organisation unavailable.');if(stopped)return;records=company?mapCompanies(data):data.organisations;selected=data.selected;ready=true;render();}catch(e){content.replaceChildren(el('p',e.message),reference());}});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import {mountProgressionDesign} from './cp-v2-progression.mjs';
|
||||
import {mountRealmEvents} from './cp-v2-events.mjs';
|
||||
import {mountElectionDesign,mountAdvertisingDesign} from './cp-v2-election-design.mjs';
|
||||
import {mountExchangeDesign} from './cp-v2-exchange-design.mjs';
|
||||
|
|
@ -8,6 +9,7 @@ import {element as el} from './cp-v2-page-template.mjs';
|
|||
import {mountNativeService} from './cp-v2-native-services.mjs';
|
||||
import {mountUserPage} from './cp-v2-user-pages.mjs';
|
||||
export function mountPlayWorkspace(host,workspace,id,options={}){
|
||||
if(workspace==='quests'||workspace==='clan'&&id==='clan-quests')return mountProgressionDesign(host,{context:workspace==='clan'?'clan':'personal',dashboard:workspace==='quests'&&id==='quest-dashboard'});
|
||||
if(workspace==='events'||workspace==='clan'&&id==='clan-events')return mountRealmEvents(host,{kind:workspace==='clan'?'clan':null,fetcher:options.fetcher||fetch});
|
||||
if(workspace==='clan'&&id==='clan-elections')return mountElectionDesign(host,{context:'clan'});
|
||||
if(workspace==='clan'&&id==='clan-advertising')return mountAdvertisingDesign(host,{context:'clan'});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export function mountPoliticalJobs(host,{officeKey,fetcher=fetch}={}){
|
|||
const field=(name,input)=>{const label=el('label',name);label.append(input);return label;};
|
||||
async function load(){try{data=await api.request('/api/jarvis/political-jobs?office='+encodeURIComponent(officeKey));if(!active)return;status.textContent=data.memberCount+' / '+data.limit+' members · public listings cost '+(data.priceMinor/100).toFixed(2)+' DM per place, payable by the officeholder.';draw();}catch(error){if(active)status.textContent=error.message;}}
|
||||
function draw(){mine.replaceChildren();for(const row of data.listings){const box=el('article',undefined,'organisation-settings-card'),link=el('a',row.title);link.href='/political-job?id='+encodeURIComponent(row.id);box.append(link,el('p',row.state+' · appointment ends '+new Date(row.expiresAt).toLocaleString('en-GB',{timeZone:'UTC'})));mine.append(box);}if(!data.listings.length)mine.append(el('p','No vacancies published.'));
|
||||
const form=el('form',undefined,'jarvis-form'),title=el('input'),message=el('textarea'),expires=el('input'),account=el('select'),check=el('input'),send=el('button','Publish vacancy'),feedback=el('p');title.maxLength=100;title.required=true;message.maxLength=1000;message.rows=4;message.required=true;expires.type='datetime-local';expires.required=true;expires.value=new Date(data.expiresAt).toISOString().slice(0,16);check.type='checkbox';check.required=true;send.type='submit';for(const row of data.accounts){const option=el('option',row.number+' · '+row.available+' DM available');option.value=row.id;account.append(option);}send.disabled=!data.accounts.length||data.memberCount>=data.limit;const promotion=el('fieldset'),channels=[];promotion.append(el('legend','Promotion'));for(const [id,name]of [['boards','Boards'],['discord','Discord']]){const input=el('input'),label=el('label');input.type='checkbox';input.value=id;input.disabled=!data.promotionChannels.includes(id);label.append(input,el('span',name));promotion.append(label);channels.push(input);}const consent=el('label');consent.append(check,el('span','Publish the role and reserve '+(data.priceMinor/100).toFixed(2)+' DM to Tax.'));form.append(field('Role title',title),field('Responsibilities and requirements',message),field('Appointment expiry · UTC',expires),field('My personal payment account',account),promotion,consent,send,feedback);post.replaceChildren(form);
|
||||
const form=el('form',undefined,'jarvis-form'),title=el('input'),message=el('textarea'),expires=el('input'),account=el('select'),check=el('input'),send=el('button','Publish vacancy'),feedback=el('p');title.maxLength=100;title.required=true;message.maxLength=1000;message.rows=4;message.required=true;expires.type='datetime-local';expires.required=true;expires.value=new Date(data.expiresAt).toISOString().slice(0,16);check.type='checkbox';check.required=true;send.type='submit';for(const row of data.accounts){const option=el('option',row.number+' · '+row.available+' DM available');option.value=row.id;account.append(option);}send.disabled=!data.accounts.length||data.memberCount>=data.limit;const promotion=el('fieldset'),channels=[];promotion.append(el('legend','Promotion'));for(const [id,name]of [['boards','Boards'],['discord','Discord']]){const input=el('input'),label=el('label');input.type='checkbox';input.value=id;input.disabled=!data.promotionChannels.includes(id);label.append(input,el('span',name+(input.disabled?' · unavailable':'')));promotion.append(label);channels.push(input);}promotion.append(el('p','Unavailable promotion channels cannot be selected or charged.'));const consent=el('label');consent.append(check,el('span','Publish the role and reserve '+(data.priceMinor/100).toFixed(2)+' DM to Tax.'));form.append(field('Role title',title),field('Responsibilities and requirements',message),field('Appointment expiry · UTC',expires),field('My personal payment account',account),promotion,consent,send,feedback);post.replaceChildren(form);
|
||||
form.onsubmit=async event=>{event.preventDefault();if(busy||send.disabled||!form.reportValidity())return;pending||={officeKey,requestId:crypto.randomUUID(),title:title.value,message:message.value,expiresAt:Date.parse(expires.value+'Z'),sourceAccount:account.value,expectedPriceMinor:data.priceMinor,channels:channels.filter(c=>c.checked).map(c=>c.value),confirmed:check.checked};busy=true;send.disabled=true;try{await api.request('/api/jarvis/political-jobs/publish',pending);pending=null;await load();status.textContent='Vacancy published on Starport. No office authority is transferred by applying.';}catch(error){feedback.textContent=error.message;}finally{busy=false;send.disabled=false;}};
|
||||
applications.replaceChildren();for(const row of data.applications){const card=el('article',undefined,'organisation-settings-card');card.append(el('h4',row.username+' · '+(data.listings.find(l=>l.id===row.listing_id)?.title||'Vacancy')),el('p',row.message),el('strong',row.status));if(row.status==='pending')for(const [decision,label]of [['accept','Accept & appoint'],['decline','Decline']]){const button=el('button',label);button.type='button';button.onclick=async()=>{if(busy||!await confirmAction(label+'?',row.username+' · '+(decision==='accept'?'Issue the appointment deed and close this vacancy.':'Decline this application.')))return;busy=true;button.disabled=true;try{await api.request('/api/jarvis/political-jobs/review',{applicationId:row.id,decision,confirmed:true});await load();status.textContent=decision==='accept'?'Appointment deed issued; vacancy closed and decision mail queued.':'Decision recorded and mail queued.';}catch(error){status.textContent=error.message;}finally{busy=false;button.disabled=false;}};card.append(button);}applications.append(card);}if(!data.applications.length)applications.append(el('p','No applications recorded.'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,943 @@
|
|||
// Design-only catalogue from accepted handovers; does not issue state or authority.
|
||||
export const MISSION_BRANCHES=[
|
||||
{
|
||||
"id": "a",
|
||||
"title": "Onboarding",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-A-01",
|
||||
"title": "Complete onboarding",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-A-02",
|
||||
"title": "Choose faction",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-A-03",
|
||||
"title": "Complete player profile",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-A-04",
|
||||
"title": "Use Spacing Guild travel",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-A-05",
|
||||
"title": "Complete Imperial Citizen introduction",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "b",
|
||||
"title": "Economy & Banking",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-B-01",
|
||||
"title": "Earn 1,000 Solari",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-B-02",
|
||||
"title": "Make first bank deposit",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-B-03",
|
||||
"title": "Complete bank transfer",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-B-04",
|
||||
"title": "Make first shop purchase",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-B-05",
|
||||
"title": "Earn 25,000 Solari cumulatively",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-B-06",
|
||||
"title": "Earn 100,000 Solari cumulatively",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-B-07",
|
||||
"title": "Earn 500,000 Solari cumulatively",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "c",
|
||||
"title": "Spice Harvesting",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-C-01",
|
||||
"title": "Harvest 100 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-02",
|
||||
"title": "Harvest 1,000 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-03",
|
||||
"title": "Harvest 5,000 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-04",
|
||||
"title": "Harvest 25,000 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-05",
|
||||
"title": "Harvest 100,000 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-06",
|
||||
"title": "Harvest 250,000 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-07",
|
||||
"title": "Harvest 500,000 verified spice",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-C-08",
|
||||
"title": "Harvest 1,000,000 verified spice",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "d",
|
||||
"title": "Survival & Exploration",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-D-01",
|
||||
"title": "Visit Arrakis",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-D-02",
|
||||
"title": "Survive 30 active minutes",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-D-03",
|
||||
"title": "Discover a sietch",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-D-04",
|
||||
"title": "Discover an oasis",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-D-05",
|
||||
"title": "Visit all accessible planets",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-D-06",
|
||||
"title": "Survive 10 active hours on Arrakis",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-D-07",
|
||||
"title": "Complete advanced survival challenges",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e",
|
||||
"title": "Careers & Jobs",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-E-01",
|
||||
"title": "Complete 1 job",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-E-02",
|
||||
"title": "Complete 5 jobs",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-E-03",
|
||||
"title": "Complete 20 jobs",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-E-04",
|
||||
"title": "Complete 50 jobs",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-E-05",
|
||||
"title": "Complete 100 jobs",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-E-06",
|
||||
"title": "Accept employment — optional",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "S1-E-07",
|
||||
"title": "Receive wages — optional",
|
||||
"optional": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "f",
|
||||
"title": "Community & Recognition",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-F-01",
|
||||
"title": "Complete forum registration",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-F-02",
|
||||
"title": "Publish first eligible post",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-F-03",
|
||||
"title": "Publish 10 eligible contributions",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-F-04",
|
||||
"title": "Publish 25 eligible contributions",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-F-05",
|
||||
"title": "Publish 50 eligible contributions",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-F-06",
|
||||
"title": "Publish 100 eligible contributions",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-F-07",
|
||||
"title": "Earn an eligible existing seal or award",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "g",
|
||||
"title": "Civic Participation",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-G-01",
|
||||
"title": "Explore the political interface",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-G-02",
|
||||
"title": "Complete a civic participation activity",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-G-03",
|
||||
"title": "Cast an election vote or complete an equivalent civic objective",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-G-04",
|
||||
"title": "Complete additional civic objectives",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-G-05",
|
||||
"title": "Participate in a public event or an always-available equivalent",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "h",
|
||||
"title": "Equipment & Upgrades",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-H-01",
|
||||
"title": "Obtain faction kit",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-02",
|
||||
"title": "Repair Your Starter Kit",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-03",
|
||||
"title": "Use equipment in gameplay",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-04",
|
||||
"title": "Complete first Mark upgrade",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-05",
|
||||
"title": "Complete first rarity enhancement",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-06",
|
||||
"title": "Upgrade an item to Mark VII",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-07",
|
||||
"title": "Upgrade an item to Mark XII",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-H-08",
|
||||
"title": "Upgrade an item to Mark XIV",
|
||||
"optional": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "i",
|
||||
"title": "Kit Design & Trading",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-I-01",
|
||||
"title": "Create first valid kit design",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-I-02",
|
||||
"title": "Publish first kit listing",
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
"id": "S1-I-03",
|
||||
"title": "Sell 1 kit — prestige",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "S1-I-04",
|
||||
"title": "Sell 5 kits — prestige",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "S1-I-05",
|
||||
"title": "Sell 25 kits — prestige",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "S1-I-06",
|
||||
"title": "Sell 100 kits — prestige",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "S1-I-07",
|
||||
"title": "Sell 500 kits — prestige",
|
||||
"optional": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "discoveries",
|
||||
"title": "Discoveries",
|
||||
"missions": [
|
||||
{
|
||||
"id": "S1-DISCOVERY",
|
||||
"title": "Discover the hidden stories of the realm",
|
||||
"optional": true,
|
||||
"hidden": true
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
export const DECISION_CATALOGUE=[
|
||||
{
|
||||
"id": "IMP-01",
|
||||
"title": "Pax Imperialis",
|
||||
"effect": "72-hour Arrakis peace; factions have 24h to accept/reject",
|
||||
"level": 50,
|
||||
"xp": 1500,
|
||||
"cost": "50,000 / 7d",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-02",
|
||||
"title": "Travel Charter",
|
||||
"effect": "72-hour sanctioned Arrakis travel for eligible organization",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "10,000 / 24h",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-03",
|
||||
"title": "Appoint Steward",
|
||||
"effect": "Issue delegated Arrakis office deed to accepting candidate",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "5,000 / 48h replacement",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-04",
|
||||
"title": "Imperial Proclamation",
|
||||
"effect": "Publish official political announcement",
|
||||
"level": 5,
|
||||
"xp": 100,
|
||||
"cost": "1,000 / 6h",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-05",
|
||||
"title": "Convene Landsraad",
|
||||
"effect": "Open 72-hour political assembly and resolution vote",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "5,000 / 72h",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-06",
|
||||
"title": "Imperial Subsidy",
|
||||
"effect": "Fund approved project up to 50,000, milestone-based",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "2,500 admin / 72h",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-07",
|
||||
"title": "Imperial Sanction",
|
||||
"effect": "Restrict new Imperial benefits for 72h after review",
|
||||
"level": 55,
|
||||
"xp": 1200,
|
||||
"cost": "25,000 / 7d",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-08",
|
||||
"title": "Secret Patronage",
|
||||
"effect": "Covertly fund eligible initiative up to 15,000",
|
||||
"level": 45,
|
||||
"xp": 900,
|
||||
"cost": "5,000 admin / 7d",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "IMP-09",
|
||||
"title": "Imperial Honour",
|
||||
"effect": "Award 30-day ceremonial seal/title",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "5,000 / 48h",
|
||||
"office": "IMP"
|
||||
},
|
||||
{
|
||||
"id": "ATR-01",
|
||||
"title": "Atreides Patronage",
|
||||
"effect": "10,000 development allocation to Caladan clan",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "10,000 / 72h",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "ATR-02",
|
||||
"title": "Council of Caladan",
|
||||
"effect": "48-hour clan consultation and nonbinding vote",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "2,000 / 48h",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "ATR-03",
|
||||
"title": "Honour of the Duke",
|
||||
"effect": "30-day Caladan ceremonial recognition",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "ATR-04",
|
||||
"title": "Waterworld Development",
|
||||
"effect": "Fund infrastructure up to 25,000",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "Grant amount / 7d",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "ATR-05",
|
||||
"title": "Diplomatic Envoy",
|
||||
"effect": "Treaty proposal with 72-hour response window",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "2,500 / 48h",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "ATR-06",
|
||||
"title": "Shield of Caladan",
|
||||
"effect": "Voluntary defensive contract up to 20,000",
|
||||
"level": 40,
|
||||
"xp": 750,
|
||||
"cost": "Contract amount / 7d",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "ATR-07",
|
||||
"title": "Call of Loyalty",
|
||||
"effect": "Seven-day voluntary Caladan clan coalition",
|
||||
"level": 50,
|
||||
"xp": 1200,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "ATR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-01",
|
||||
"title": "Industrial Quotas",
|
||||
"effect": "Seven-day opt-in production contracts",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "2,500 admin / 72h",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-02",
|
||||
"title": "Baronial Patronage",
|
||||
"effect": "Development funding up to 15,000",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "Grant amount / 72h",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-03",
|
||||
"title": "Industrial Monopoly Bid",
|
||||
"effect": "72-hour tender, 14-day exclusive government order",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-04",
|
||||
"title": "Political Pressure",
|
||||
"effect": "72-hour contestable political censure",
|
||||
"level": 40,
|
||||
"xp": 750,
|
||||
"cost": "10,000 / 7d",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-05",
|
||||
"title": "Intelligence Network",
|
||||
"effect": "48-hour approved political investigation",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "7,500 / 72h",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-06",
|
||||
"title": "War Industry Contract",
|
||||
"effect": "Equipment order up to 30,000",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "Contract amount / 7d",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "HAR-07",
|
||||
"title": "Baron's Favour",
|
||||
"effect": "Seven-day contract invitation or honour",
|
||||
"level": 50,
|
||||
"xp": 1200,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "HAR"
|
||||
},
|
||||
{
|
||||
"id": "COR-01",
|
||||
"title": "Imperial Court Audience",
|
||||
"effect": "Official diplomatic event",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "1,000 / 24h",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "COR-02",
|
||||
"title": "Court Patronage",
|
||||
"effect": "Project funding up to 15,000",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "Grant amount / 72h",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "COR-03",
|
||||
"title": "Noble Recognition",
|
||||
"effect": "30-day ceremonial title/seal",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "COR-04",
|
||||
"title": "Treasury Investment",
|
||||
"effect": "Kaitain project up to 25,000",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "Grant amount / 7d",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "COR-05",
|
||||
"title": "Court Intrigue",
|
||||
"effect": "48-hour confidential political investigation",
|
||||
"level": 40,
|
||||
"xp": 750,
|
||||
"cost": "7,500 / 72h",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "COR-06",
|
||||
"title": "Dynastic Alliance",
|
||||
"effect": "14-day consenting political alliance",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "COR-07",
|
||||
"title": "Claim to Influence",
|
||||
"effect": "Petition for 14-day advisory representation",
|
||||
"level": 50,
|
||||
"xp": 1200,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "COR"
|
||||
},
|
||||
{
|
||||
"id": "ORD-01",
|
||||
"title": "Commercial Expansion",
|
||||
"effect": "10,000 company development contract",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "10,000 / 72h",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "ORD-02",
|
||||
"title": "Secret Consortium",
|
||||
"effect": "14-day confidential company agreement",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "ORD-03",
|
||||
"title": "Market Intelligence",
|
||||
"effect": "Approved aggregate trade report",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "ORD-04",
|
||||
"title": "Trade Incentive",
|
||||
"effect": "Seven-day subsidy pool up to 20,000",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "Pool amount / 7d",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "ORD-05",
|
||||
"title": "Shadow Negotiation",
|
||||
"effect": "Confidential proposal, 72-hour response",
|
||||
"level": 40,
|
||||
"xp": 750,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "ORD-06",
|
||||
"title": "Industrial Innovation",
|
||||
"effect": "Equipment/kit project funding up to 25,000",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "Grant amount / 7d",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "ORD-07",
|
||||
"title": "Economic Leverage",
|
||||
"effect": "Seven-day preferred government supply contract",
|
||||
"level": 50,
|
||||
"xp": 1200,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "ORD"
|
||||
},
|
||||
{
|
||||
"id": "FRE-01",
|
||||
"title": "Council Assembly",
|
||||
"effect": "48-hour Naib vote",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "1,000 / 24h",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "FRE-02",
|
||||
"title": "Defend Sietches",
|
||||
"effect": "Seven-day voluntary defense coalition",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "15,000 / 7d",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "FRE-03",
|
||||
"title": "Water Discipline",
|
||||
"effect": "Seven-day water-sharing agreement",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "FRE-04",
|
||||
"title": "Spice Sovereignty",
|
||||
"effect": "Challenge Imperial spice concession",
|
||||
"level": 40,
|
||||
"xp": 750,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "FRE-05",
|
||||
"title": "Reject Imperial Peace",
|
||||
"effect": "Record Council rejection of Pax Imperialis",
|
||||
"level": 50,
|
||||
"xp": 1200,
|
||||
"cost": "Free / per declaration",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "FRE-06",
|
||||
"title": "Desert Alliance",
|
||||
"effect": "14-day consenting Fremen alliance",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "FRE-07",
|
||||
"title": "Voice of Arrakis",
|
||||
"effect": "Petition Emperor/Steward, 72-hour response",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "1,000 / 48h",
|
||||
"office": "FRE"
|
||||
},
|
||||
{
|
||||
"id": "BG-01",
|
||||
"title": "Hidden Hand",
|
||||
"effect": "48-hour covert political operation",
|
||||
"level": 45,
|
||||
"xp": 900,
|
||||
"cost": "10,000 / 72h",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "BG-02",
|
||||
"title": "Observe Candidate",
|
||||
"effect": "48-hour permitted candidate intelligence review",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "2,500 / 48h",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "BG-03",
|
||||
"title": "Sisterhood Patronage",
|
||||
"effect": "Confidential sponsorship up to 10,000",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "Funding + 2,500 / 7d",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "BG-04",
|
||||
"title": "Political Prophecy",
|
||||
"effect": "Publish/private intelligence assessment",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "5,000 / 72h",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "BG-05",
|
||||
"title": "Whispered Alliance",
|
||||
"effect": "Seven-day confidential diplomatic agreement",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "BG-06",
|
||||
"title": "Unmask Conspiracy",
|
||||
"effect": "72-hour investigation and possible exposure",
|
||||
"level": 50,
|
||||
"xp": 1200,
|
||||
"cost": "10,000 / 7d",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "BG-07",
|
||||
"title": "Sisterhood's Favour",
|
||||
"effect": "Seven-day diplomatic endorsement",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "BG"
|
||||
},
|
||||
{
|
||||
"id": "SG-01",
|
||||
"title": "Guild Transport Mandate",
|
||||
"effect": "Seven-day transport agreement",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "5,000 / 72h",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "SG-02",
|
||||
"title": "Priority Passage",
|
||||
"effect": "72-hour transport discount/priority",
|
||||
"level": 15,
|
||||
"xp": 250,
|
||||
"cost": "2,500 / 48h",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "SG-03",
|
||||
"title": "Guild Subsidy",
|
||||
"effect": "Seven-day travel subsidy up to 20,000",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "Subsidy amount / 7d",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "SG-04",
|
||||
"title": "Commercial Intelligence",
|
||||
"effect": "Aggregate transport/trade report",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "SG-05",
|
||||
"title": "Transport Surcharge",
|
||||
"effect": "Seven-day capped surcharge up to 5%",
|
||||
"level": 40,
|
||||
"xp": 750,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "SG-06",
|
||||
"title": "Guild Mediation",
|
||||
"effect": "72-hour political dispute mediation",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "5,000 / 72h",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "SG-07",
|
||||
"title": "Guild's Favour",
|
||||
"effect": "Seven-day preferred transport status",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "SG"
|
||||
},
|
||||
{
|
||||
"id": "CLD-01",
|
||||
"title": "Clan Petition",
|
||||
"effect": "Formal grievance, 72-hour response",
|
||||
"level": 10,
|
||||
"xp": 200,
|
||||
"cost": "1,000 / 48h",
|
||||
"office": "CLD"
|
||||
},
|
||||
{
|
||||
"id": "CLD-02",
|
||||
"title": "Kanly Declaration",
|
||||
"effect": "Register homeworld clan feud",
|
||||
"level": 25,
|
||||
"xp": 400,
|
||||
"cost": "2,500 / 48h",
|
||||
"office": "CLD"
|
||||
},
|
||||
{
|
||||
"id": "CLD-03",
|
||||
"title": "Challenge Concession",
|
||||
"effect": "72-hour resource/grant dispute",
|
||||
"level": 35,
|
||||
"xp": 600,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "CLD"
|
||||
},
|
||||
{
|
||||
"id": "CLD-04",
|
||||
"title": "Clan Coalition",
|
||||
"effect": "Seven-day voluntary clan coalition",
|
||||
"level": 20,
|
||||
"xp": 300,
|
||||
"cost": "5,000 / 7d",
|
||||
"office": "CLD"
|
||||
},
|
||||
{
|
||||
"id": "CLD-05",
|
||||
"title": "Demand Representation",
|
||||
"effect": "Request hearing/vote, 72-hour response",
|
||||
"level": 30,
|
||||
"xp": 500,
|
||||
"cost": "2,500 / 72h",
|
||||
"office": "CLD"
|
||||
}
|
||||
];
|
||||
2
website/control-panel/public/cp-v2/cp-v2-progression.css
Normal file
2
website/control-panel/public/cp-v2/cp-v2-progression.css
Normal file
File diff suppressed because one or more lines are too long
45
website/control-panel/public/cp-v2/cp-v2-progression.mjs
Normal file
45
website/control-panel/public/cp-v2/cp-v2-progression.mjs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import {element as el} from './cp-v2-page-template.mjs';
|
||||
import {MISSION_BRANCHES,DECISION_CATALOGUE} from './cp-v2-progression-catalogue.mjs';
|
||||
const ASSETS='https://www.dunerealms.com/assets/';
|
||||
const lore=text=>String(text).replace(/Arrakis/g,'Arrakduin').replace(/Caladan/g,'Kaladam').replace(/Kaitain/g,'Kaiterhof').replace(/Atreides/g,'Aerdrecht').replace(/Harkonnen/g,'Harkveen').replace(/Corrino/g,'Korenholt').replace(/Ordos/g,'Oordwijk').replace(/Bene Gesserit/g,'Veiled Concord');
|
||||
const CONTEXTS={personal:['Personal','nav-account-v2.webp'],clan:['Clan','nav-clan-v2.webp'],company:['Company','guild.webp'],politics:['Politics','seals/emperor-v1.png']};
|
||||
const OFFICES=[['IMP','Imperial Senate'],['ATR','House Aerdrecht'],['HAR','House Harkveen'],['COR','House Korenholt'],['ORD','House Oordwijk'],['FRE','Council of Naibs'],['BG','Veiled Concord'],['SG','Spacing Guild'],['CLD','Clan Delegate']];
|
||||
const SEALS=[['Aerdrecht','house-aerdrecht-v1.png'],['Harkveen','house-harkveen-v1.png'],['Korenholt','house-korenholt-v1.png'],['Oordwijk','house-oordwijk-v1.png'],['Fremen','office-house_leader.png']];
|
||||
const artFor=id=>id==='h'?'progression/repair-workshop.webp':id==='i'?'imperial-atelier-v1.webp':id==='c'?'exchange-quests-v1.png':id==='b'?'imperial-postbank-v2.png':id==='f'?'nav-boards-v2.webp':'exchange-starport-header-v2.webp';
|
||||
function image(file,alt=''){const n=el('img');n.src=ASSETS+file;n.alt=alt;n.loading='lazy';return n;}
|
||||
function button(text,action,cls=''){const n=el('button',text,cls);n.type='button';n.onclick=action;return n;}
|
||||
function field(label,values){const wrap=el('label',undefined,'progression-field'),input=el('select');wrap.append(el('span',label));for(const value of values)input.append(el('option',value));wrap.append(input);return wrap;}
|
||||
export function mountProgressionDesign(host,{context='personal',dashboard=false,organisation=null,members=[],office='IMP',manage=false}={}){
|
||||
if(!Object.hasOwn(CONTEXTS,context))context='personal';
|
||||
if(!document.querySelector('link[data-progression-design]')){const link=el('link');link.rel='stylesheet';link.href=new URL('./cp-v2-progression.css',import.meta.url).href;link.dataset.progressionDesign='';document.head.append(link);}
|
||||
const root=el('section',undefined,'progression-workspace'),notice=el('p','Design preview · Sample layout only. No XP, rewards, appointments or payments are issued.','progression-notice');
|
||||
let activeContext=context,tab='missions',selected=null,branch='a',officeCode=office,query='';
|
||||
let connectorObserver=null;
|
||||
const hero=el('header',undefined,'progression-hero'),head=el('div');head.append(el('small',manage?'IMPERIAL BUREAU · J.A.R.V.I.S.':'REALM PROGRESSION'),el('h2',manage?'Progression definitions':dashboard?'Quest Dashboard':'Missions & Decisions'),el('p','Your objectives, authority and recorded achievements.'));hero.append(image('exchange-quests-v1.png'),head);root.append(hero,notice);
|
||||
const contextNav=el('nav',undefined,'progression-contexts'),gallery=el('section',undefined,'progression-gallery'),nav=el('nav',undefined,'progression-tabs'),content=el('section',undefined,'progression-content');nav.setAttribute('aria-label','Progression views');contextNav.setAttribute('aria-label','Progression contexts');
|
||||
if(dashboard)root.append(contextNav);root.append(gallery,nav,content);host.replaceChildren(root);
|
||||
function renderGallery(){gallery.replaceChildren();gallery.hidden=activeContext==='personal'||manage;gallery.className='progression-gallery'+(activeContext==='politics'&&officeCode==='IMP'?' progression-imperial':'');if(gallery.hidden)return;
|
||||
const title=activeContext==='politics'?OFFICES.find(([id])=>id===officeCode)?.[1]:organisation?.name||CONTEXTS[activeContext][0];gallery.append(el('h3',title||'Your organisation'));
|
||||
if(activeContext==='politics'&&officeCode==='IMP'){const throne=el('div',undefined,'progression-throne');throne.append(image('seals/emperor-v1.png'),el('strong','Padishah Emperor'),el('span','Officeholder avatar · preview'));gallery.append(throne);const seals=el('div',undefined,'progression-electors');for(const[name,file]of SEALS){const card=el('figure');card.append(image('seals/'+file),el('figcaption',name),el('span','Leader avatar · preview'));seals.append(card);}gallery.append(seals);return;}
|
||||
const roster=el('div',undefined,'progression-roster');for(const member of members.slice(0,12)){const person=el('figure');const avatar=member.avatar||member.avatarUrl||(member.username?'https://cp.dunerealms.com/api/avatars/face/roster/'+encodeURIComponent(member.username):null);if(avatar&&/^https:\/\//.test(avatar)){const img=el('img');img.src=avatar;img.alt='';person.append(img);}else person.append(image(CONTEXTS[activeContext][1]));person.append(el('figcaption',member.displayName||member.display_name||member.name||member.username||'Member'));roster.append(person);}if(!members.length)roster.append(image(CONTEXTS[activeContext][1]),el('p','Your verified roster and avatars will appear here. No sample memberships are assigned.'));gallery.append(roster);
|
||||
}
|
||||
function details(row,isDecision=false){const pane=el('aside',undefined,'progression-detail');pane.setAttribute('aria-label','Selected '+(isDecision?'decision':'mission'));pane.append(image(isDecision?'exchange-political-positions-v1.png':artFor(branch)),el('small',row.id),el('h3',lore(row.title)),el('p',isDecision?lore(row.effect):row.title==='Repair Your Starter Kit'?'Collect four repair components and surrender the damaged Q0 kit to receive one intact kit.':'Complete the verified objective. Conditions and progress will be supplied by J.A.R.V.I.S.'));
|
||||
const dl=el('dl');for(const[label,value]of isDecision?[['Authority','Current deed · checked on execution'],['Level',String(row.level)],['XP',row.xp+' · proposal'],['Cost / cooldown',row.cost+' · handover values'],['Currency','Accounting mapping pending; no charge enabled']]:[['Progress','Not connected'],['Season','Season 1 · design'],['Completion',row.optional?'Optional / prestige':'Required objective'],['Reward','Configured reward · pending review']])dl.append(el('dt',label),el('dd',value));pane.append(dl);
|
||||
if(row.title==='Repair Your Starter Kit'){const parts=el('div',undefined,'progression-repair');for(const[file,title]of [['iron_ingot.png','Repair plate'],['leather_chestplate.png','Binding patch'],['copper_ingot.png','Tool fitting'],['quartz.png','Calibration piece']]){const part=el('figure');part.append(image('minecraft-items/'+file),el('figcaption',title+' · concept'));parts.append(part);}pane.append(parts);}
|
||||
if(isDecision)pane.append(field('Target',['Select eligible target · preview']));const action=button(isDecision?'Execute decision · pending integration':'Claim reward · pending integration');action.disabled=true;pane.append(action,el('p','J.A.R.V.I.S. dossier · no live execution reference exists yet.','progression-muted'));return pane;
|
||||
}
|
||||
function renderMissions(){const toolbar=el('div',undefined,'progression-toolbar'),select=field('Mission branch',MISSION_BRANCHES.map(b=>b.title)),season=field('Season',['Season 1','Season archive · preview']);select.querySelector('select').selectedIndex=MISSION_BRANCHES.findIndex(b=>b.id===branch);select.onchange=e=>{branch=MISSION_BRANCHES[e.target.selectedIndex].id;selected=null;render();};toolbar.append(select,season);content.append(toolbar);
|
||||
if(activeContext==='personal'){const stats=el('div',undefined,'progression-stats');stats.append(el('strong','XP & level · awaiting connection'),el('span','Season cap 70 · proposed'),el('span','Halfway & completion milestones'),el('progress'));content.append(stats);}else{const info=el('p',activeContext==='politics'?'Office objectives are supplemental. Holding office is never required for personal seasonal completion.':'Organisation mission tree · shared component; organisation-specific objectives await definition.','progression-notice');content.append(info);}
|
||||
const b=MISSION_BRANCHES.find(b=>b.id===branch)||MISSION_BRANCHES[0],rows=activeContext==='personal'?b.missions:activeContext==='politics'?DECISION_CATALOGUE.filter(d=>d.office===officeCode).map(d=>({id:'MISSION-'+d.id,title:d.title+' · office objective',optional:true})):[];
|
||||
const layout=el('div',undefined,'progression-layout'),tree=el('div',undefined,'progression-tree');tree.setAttribute('aria-label','Mission tree');if(!rows.length){tree.append(image(CONTEXTS[activeContext][1]),el('h3','Organisation mission tree'),el('p','The roster, tree, objectives and reward panel are ready for shared definitions. Personal mission requirements are not copied onto organisations.'));layout.append(tree);content.append(layout);return;}
|
||||
selected=rows.find(r=>r.id===selected)?.id||rows[0].id;for(const row of rows){const card=button('',()=>{selected=row.id;render();},'progression-mission');card.dataset.missionId=row.id;card.setAttribute('aria-pressed',String(row.id===selected));card.append(image(artFor(branch)),el('strong',lore(row.title)),el('span',row.optional?'Optional · preview':'Not connected','progression-badge'));tree.append(card);}layout.append(tree,details(rows.find(r=>r.id===selected)));content.append(layout);
|
||||
const svg=document.createElementNS('http://www.w3.org/2000/svg','svg');svg.classList.add('progression-connectors');svg.setAttribute('aria-hidden','true');tree.prepend(svg);
|
||||
const connect=()=>{if(!tree.isConnected)return;const origin=tree.getBoundingClientRect();svg.setAttribute('viewBox','0 0 '+origin.width+' '+origin.height);svg.replaceChildren();const cards=[...tree.querySelectorAll('[data-mission-id]')];for(let i=1;i<cards.length;i++){const a=cards[i-1].getBoundingClientRect(),b=cards[i].getBoundingClientRect(),line=document.createElementNS(svg.namespaceURI,'path');const sameRow=Math.abs(a.top-b.top)<5;const x1=sameRow?a.right-origin.left:a.left-origin.left+a.width/2,y1=sameRow?a.top-origin.top+a.height/2:a.bottom-origin.top,x2=sameRow?b.left-origin.left:b.left-origin.left+b.width/2,y2=sameRow?b.top-origin.top+b.height/2:b.top-origin.top;line.setAttribute('d',sameRow?'M '+x1+' '+y1+' H '+x2:'M '+x1+' '+y1+' V '+(y1+14)+' H '+x2+' V '+y2);svg.append(line);}};
|
||||
connectorObserver=new ResizeObserver(connect);connectorObserver.observe(tree);requestAnimationFrame(connect);
|
||||
}
|
||||
function renderDecisions(){const toolbar=el('div',undefined,'progression-toolbar'),search=el('input');search.type='search';search.placeholder='Search decisions';search.setAttribute('aria-label','Search decisions');search.value=query;search.oninput=()=>{query=search.value;renderDecisionsList();};toolbar.append(search);if((dashboard&&activeContext==='politics')||manage){const chooser=field('Office catalogue',OFFICES.map(([,name])=>name));chooser.querySelector('select').selectedIndex=OFFICES.findIndex(([id])=>id===officeCode);chooser.onchange=e=>{officeCode=OFFICES[e.target.selectedIndex][0];selected=null;render();};toolbar.append(chooser);}content.append(toolbar);const listHost=el('div');content.append(listHost);
|
||||
function renderDecisionsList(){listHost.replaceChildren();let rows=activeContext==='politics'||manage?DECISION_CATALOGUE.filter(d=>d.office===officeCode):activeContext==='personal'?[{id:'P-MARK',title:'Equipment Mark eligibility',effect:'Level, materials and equipment restrictions remain necessary.',level:0,xp:0,cost:'Pending configuration'},{id:'P-RARITY',title:'Rarity enhancement eligibility',effect:'Use the existing rarity and Legendary upgrade policy.',level:0,xp:0,cost:'Pending configuration'},{id:'P-SEASON',title:'Seasonal completion entitlement',effect:'One non-tradable completion kit after all mandatory objectives.',level:0,xp:0,cost:'Earned entitlement'}]:[];rows=rows.filter(r=>(r.title+' '+r.effect).toLowerCase().includes(query.toLowerCase()));if(!rows.length){listHost.append(el('p','No decision definitions available for this selection. No authority is inferred.'));return;}selected=rows.find(r=>r.id===selected)?.id||rows[0].id;const layout=el('div',undefined,'progression-layout'),cards=el('div',undefined,'progression-decisions');for(const row of rows){const card=button('',()=>{selected=row.id;renderDecisionsList();},'progression-decision');card.setAttribute('aria-pressed',String(row.id===selected));card.append(image('exchange-political-positions-v1.png'),el('small',row.id),el('strong',row.title),el('span','View proposal · execution unavailable'));cards.append(card);}layout.append(cards,details(rows.find(r=>r.id===selected),true));listHost.append(layout);}renderDecisionsList();
|
||||
}
|
||||
function render(){connectorObserver?.disconnect();root.dataset.context=activeContext;contextNav.replaceChildren();for(const[id,[label]]of Object.entries(CONTEXTS)){const b=button(label,()=>{activeContext=id;selected=null;query='';render();});b.setAttribute('aria-pressed',String(id===activeContext));contextNav.append(b);}renderGallery();nav.replaceChildren();for(const[id,label]of [['missions',manage?'Mission Definitions':'Missions'],['decisions',manage?'Decision Definitions':'Decisions'],...(manage?[['rewards','Progression & Rewards']]:[]),['history','History']]){const b=button(label,()=>{tab=id;selected=null;render();});b.setAttribute('aria-pressed',String(tab===id));nav.append(b);}content.replaceChildren();if(tab==='missions')renderMissions();else if(tab==='decisions')renderDecisions();else if(tab==='rewards'){content.append(el('h3','Progression & Rewards'),field('Season cap',['70 · proposed']),field('Milestone announcements',['Halfway and completion only']),el('p','Rewards, XP curves, repair recipes and signing editions await backend review. No configuration writes enabled.'));}else content.append(el('h3','J.A.R.V.I.S. History'),el('p','Verified completion, claims, decisions and any staff overrides will appear here after integration. No sample audit records are shown.'));}
|
||||
render();return()=>{connectorObserver?.disconnect();root.remove();};
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ export function mountUserPage(host,id,{fetcher=fetch,initialTab,listingId}={}){
|
|||
const view=mountInventory(inventory,{request:api.request,visibleTabs:['inventory','history'],title:'Saved inventory'});dispose=()=>{view.clear();root.remove();};return;
|
||||
}
|
||||
if(['shop-settings','exchange-settings'].includes(id)){const {mountUserCommerce}=await import('./cp-v2-user-commerce.mjs');if(active)dispose=mountUserCommerce(host,id,{fetcher});return;}
|
||||
if(id==='quests'){mountQuests();return;}
|
||||
if(id==='quests'){const {mountProgressionDesign}=await import('./cp-v2-progression.mjs');if(active)dispose=mountProgressionDesign(host,{context:'personal'});return;}
|
||||
if(id==='discord-link'){
|
||||
const box=el('section',undefined,'cp-v2-personal-box'),{root}=createCPV2Page({shellHost:host,title:'Discord Link',description:'Your Discord community presence and account-linking availability.',artwork:'nav-discord-v2.webp',tabs:[{id:'discord-identity',label:'Discord identity',content:box}]});host.replaceChildren(root);
|
||||
box.append(el('h4','Community connection'),el('p','Loading your public Discord record…'));const data=await api.request('/api/account/profile');if(!active)return;box.replaceChildren(el('h4','Community connection'));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,7 @@ try {
|
|||
$map=$db->fetch_array($db->simple_select('dune_jarvis_identity','uid',"system_id='$identity'"));
|
||||
$user=$map?$db->fetch_array($db->simple_select('users','uid,username,usergroup','uid='.(int)$map['uid'])):$db->fetch_array($db->simple_select('users','uid,username,usergroup',"LOWER(username)='jarvis'"));
|
||||
if($user&&!$map){$verified=$db->table_exists('dune_accounts')?$db->fetch_array($db->simple_select('dune_accounts','uid',"website_id='$identity' AND uid=".(int)$user['uid'])):null;if(!$verified)throw new Exception('Jarvis identity collision');}
|
||||
if(!$user){require_once MYBB_ROOT.'inc/datahandlers/user.php';$handler=new UserDataHandler('insert');$password=bin2hex(random_bytes(24));$handler->set_data(['username'=>'Jarvis','password'=>$password,'password2'=>$password,'email'=>'jarvis@accounts.dunerealms.invalid','usergroup'=>2,'additionalgroups'=>'','displaygroup'=>0,'regdate'=>TIME_NOW,'timezone'=>0,'language'=>'','options'=>['receivepms'=>0,'allownotices'=>0,'emailnotify'=>0]]);if(!$handler->validate_user())throw new Exception('Jarvis account validation failed');$created=$handler->insert_user();$user=['uid'=>(int)$created['uid'],'username'=>'Jarvis','usergroup'=>2];}
|
||||
if(!$user){require_once MYBB_ROOT.'inc/datahandlers/user.php';$handler=new UserDataHandler('insert');$password=bin2hex(random_bytes(12));$handler->set_data(['username'=>'Jarvis','password'=>$password,'password2'=>$password,'email'=>'jarvis@accounts.dunerealms.invalid','usergroup'=>2,'additionalgroups'=>'','displaygroup'=>0,'regdate'=>TIME_NOW,'timezone'=>0,'language'=>'','options'=>['receivepms'=>0,'allownotices'=>0,'emailnotify'=>0]]);if(!$handler->validate_user())throw new Exception('Jarvis account validation failed');$created=$handler->insert_user();$user=['uid'=>(int)$created['uid'],'username'=>'Jarvis','usergroup'=>2];}
|
||||
if(!$user||my_strtolower($user['username'])!=='jarvis'||(int)$user['usergroup']!==2)throw new Exception('Jarvis must remain a regular account');
|
||||
if(!$map)$db->insert_query('dune_jarvis_identity',['system_id'=>$identity,'uid'=>(int)$user['uid']]);
|
||||
} finally {$db->write_query("SELECT RELEASE_LOCK('dune_jarvis_identity')");}
|
||||
|
|
|
|||
35
website/node/jarvis-event-publication.mjs
Normal file
35
website/node/jarvis-event-publication.mjs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import {createHash,randomUUID} from 'node:crypto';
|
||||
// Public server events reuse the existing listing/publication queue. Personal
|
||||
// and organisation calendars never acquire public promotion through this adapter.
|
||||
export async function mirrorPublicServerEvents(bank,{edition,clock=Date.now}={}){
|
||||
const now=clock();let cursorTime=-1,cursorId='',changed=0;
|
||||
for(let page=0;page<5;page++){
|
||||
const rows=await bank.query("SELECT e.* FROM jarvis_events e WHERE e.scope_kind='server' AND e.scope_id='realm' AND ((e.state='scheduled' AND e.ends_at>? AND NOT EXISTS(SELECT 1 FROM jarvis_listings l WHERE l.id=e.id)) OR EXISTS(SELECT 1 FROM jarvis_listings l WHERE l.id=e.id AND l.definition_id='events' AND l.organisation_kind='server' AND (l.revision<>e.revision OR (l.state='open' AND (e.state='cancelled' OR e.ends_at<=?))))) AND (e.updated_at>? OR (e.updated_at=? AND e.id>?)) ORDER BY e.updated_at,e.id LIMIT 100",[now,now,cursorTime,cursorTime,cursorId]);
|
||||
if(!rows.length)break;
|
||||
for(const row of rows){
|
||||
const state=row.state==='cancelled'?'cancelled':Number(row.ends_at)<=now?'filled':'open',message=row.description+'\n\n'+new Date(Number(row.starts_at)).toISOString()+' — '+new Date(Number(row.ends_at)).toISOString();
|
||||
const fingerprint=createHash('sha256').update(JSON.stringify([row.id,row.title,message,state,Number(row.revision)])).digest('hex');
|
||||
const prior=await bank.first('SELECT definition_id,organisation_kind,fingerprint FROM jarvis_listings WHERE id=?',[row.id]);
|
||||
if(prior&&(prior.definition_id!=='events'||prior.organisation_kind!=='server'))throw Error('Event publication reference collision');
|
||||
if(prior?.fingerprint===fingerprint)continue;
|
||||
const origin=prior?null:await edition();
|
||||
await bank.transaction(async tx=>{
|
||||
const current=await tx.first('SELECT definition_id,organisation_kind,fingerprint FROM jarvis_listings WHERE id=? FOR UPDATE',[row.id]);
|
||||
if(current&&(current.definition_id!=='events'||current.organisation_kind!=='server'))throw Error('Event publication reference collision');
|
||||
if(current?.fingerprint===fingerprint)return;
|
||||
if(!current){
|
||||
if(state!=='open')return;
|
||||
await tx.query("INSERT INTO jarvis_listings(id,request_id,actor_id,organisation_kind,organisation_id,definition_id,title,message,organisation_name,world_name,fee_minor,release_stage,release_version,season_id,rarity,state,revision,fingerprint,created_at,updated_at) VALUES(?,?,?,'server','realm','events',?,?,'DuneRealms server events','Realm',0,?,?,?,'common',?,?,?,?,?)",[row.id,row.id,row.actor_id,row.title,message,origin.stage,origin.version,origin.season,state,Number(row.revision),fingerprint,Number(row.created_at),now]);
|
||||
await tx.query("INSERT INTO jarvis_promotion_jobs(id,listing_id,channel,state,next_attempt,created_at) VALUES(?,?,'discord','queued',?,?)",[randomUUID(),row.id,now,now]);
|
||||
}else{
|
||||
await tx.query('UPDATE jarvis_listings SET title=?,message=?,state=?,revision=?,fingerprint=?,updated_at=? WHERE id=?',[row.title,message,state,Number(row.revision),fingerprint,now,row.id]);
|
||||
await tx.query("UPDATE jarvis_promotion_jobs SET next_attempt=? WHERE listing_id=? AND channel='discord' AND state='sent'",[now,row.id]);
|
||||
}
|
||||
changed++;
|
||||
});
|
||||
}
|
||||
cursorTime=Number(rows.at(-1).updated_at);cursorId=rows.at(-1).id;
|
||||
if(rows.length<100)break;
|
||||
}
|
||||
return {changed};
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ export const JARVIS_LISTING_SCHEMA=[
|
|||
`CREATE TABLE IF NOT EXISTS jarvis_promotion_jobs(id CHAR(36) PRIMARY KEY,listing_id CHAR(36) NOT NULL,channel VARCHAR(16) NOT NULL,state VARCHAR(16) NOT NULL,attempts INT NOT NULL DEFAULT 0,next_attempt BIGINT NOT NULL,created_at BIGINT NOT NULL,UNIQUE KEY jarvis_promotion_once(listing_id,channel),FOREIGN KEY(listing_id) REFERENCES jarvis_listings(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`
|
||||
];
|
||||
export async function initializeJarvisListings(store){for(const sql of JARVIS_LISTING_SCHEMA)await store.query(sql);}
|
||||
export function publicJarvisListing(row){return {id:row.id,organisationKind:row.organisation_kind,organisationId:row.organisation_id,category:row.organisation_kind==='company'?'company':'recruitment',type:['clan-recruitment','company-recruitment'].includes(row.definition_id)?'recruitment':row.definition_id,title:row.title,description:row.message,owner:row.organisation_name,world:row.world_name,createdAt:Number(row.created_at),revision:Number(row.revision),state:row.state,quality:row.rarity,edition:{stage:row.release_stage,version:row.release_version,season:row.season_id}};}
|
||||
export function publicJarvisListing(row){return {id:row.id,organisationKind:row.organisation_kind,organisationId:row.organisation_id,category:row.definition_id==='events'?'events':row.organisation_kind==='company'?'company':'recruitment',type:['clan-recruitment','company-recruitment'].includes(row.definition_id)?'recruitment':row.definition_id,title:row.title,description:row.message,owner:row.organisation_name,world:row.world_name,createdAt:Number(row.created_at),revision:Number(row.revision),state:row.state,quality:row.rarity,edition:{stage:row.release_stage,version:row.release_version,season:row.season_id}};}
|
||||
// One publication ledger. Domain adapters supply current deed/capacity checks and
|
||||
// the bank reservation writes use the SAME transaction as the listing and credits.
|
||||
export function createJarvisListings(store,{authority,reserveFee,edition,clock=Date.now,promotionChannels=[]}){
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import {mirrorPublicServerEvents} from './jarvis-event-publication.mjs';
|
||||
import {currentCodexEdition} from './organisation-key-service.mjs';
|
||||
import {campaignDestination} from './election-campaigns.mjs';
|
||||
import {readFile} from 'node:fs/promises';import {execFile} from 'node:child_process';import {fileURLToPath} from 'node:url';import {createHash,randomUUID} from 'node:crypto';
|
||||
import {validateNewsWebhook} from './discord-news.mjs';
|
||||
export const STARPORT_CHANNEL='1572558298467541084';
|
||||
export const PROMOTION_DELIVERY_SCHEMA=`CREATE TABLE IF NOT EXISTS jarvis_promotion_delivery(job_id CHAR(36) PRIMARY KEY,reference_id VARCHAR(40) NOT NULL DEFAULT '',revision_hash CHAR(64) NOT NULL DEFAULT '',claim_token CHAR(36) NOT NULL DEFAULT '',claimed_at BIGINT NOT NULL DEFAULT 0,last_error VARCHAR(100) NOT NULL DEFAULT '') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`;
|
||||
export const nativePromotion=payload=>new Promise((resolve,reject)=>{const child=execFile('/usr/bin/php',[fileURLToPath(new URL('../integrations/mybb/jarvis-promotion.php',import.meta.url))],{timeout:25000,maxBuffer:32000},(error,stdout)=>{try{if(error)throw error;const result=JSON.parse(stdout);if(!result.ok)throw Error('Forum delivery unconfirmed');resolve(result);}catch{reject(Error('Forum delivery pending'));}});child.stdin.on('error',()=>{});child.stdin.end(JSON.stringify(payload));});
|
||||
export function promotionPayload(row,closed){const source={id:row.id,title:row.title,message:row.message,owner:row.organisation_name,status:closed?'closed':'open',url:row.definition_id==='political-job'?'https://cp.dunerealms.com/political-job?id='+row.id:row.definition_id==='campaign'?campaignDestination(row.campaign_kind,row.campaign_faction):'https://cp.dunerealms.com/jarvis-application?listing='+row.id};return {...source,revision:createHash('sha256').update(JSON.stringify(source)).digest('hex')};}
|
||||
export function createPromotionDelivery(central,bank,{config=null,sendForum=nativePromotion,fetcher=fetch,clock=Date.now,boards=false}={}){
|
||||
export function promotionPayload(row,closed){const source={id:row.id,title:row.title,message:row.message,owner:row.organisation_name,status:closed?'closed':'open',url:row.definition_id==='events'?'https://cp.dunerealms.com/#events':row.definition_id==='political-job'?'https://cp.dunerealms.com/political-job?id='+row.id:row.definition_id==='campaign'?campaignDestination(row.campaign_kind,row.campaign_faction):'https://cp.dunerealms.com/jarvis-application?listing='+row.id};return {...source,revision:createHash('sha256').update(JSON.stringify(source)).digest('hex')};}
|
||||
export function createPromotionDelivery(central,bank,{config=null,sendForum=nativePromotion,fetcher=fetch,clock=Date.now,boards=false,serverEvents=false,edition=null}={}){
|
||||
const webhook=config?validateNewsWebhook(config,{channelId:STARPORT_CHANNEL}):null,channels=[...(boards?['boards']:[]),...(webhook?['discord']:[])];
|
||||
return {channels,async drain(){
|
||||
const now=clock();await bank.query("UPDATE jarvis_promotion_jobs SET state='uncertain' WHERE channel='discord' AND state='sending' AND id IN (SELECT job_id FROM jarvis_promotion_delivery WHERE claimed_at<?)",[now-120000]);await bank.query("UPDATE jarvis_promotion_jobs SET state='retry' WHERE channel='boards' AND state='sending' AND id IN (SELECT job_id FROM jarvis_promotion_delivery WHERE claimed_at<?)",[now-120000]);
|
||||
const now=clock();if(serverEvents&&channels.includes('discord'))await mirrorPublicServerEvents(bank,{edition,clock});await bank.query("UPDATE jarvis_promotion_jobs SET state='uncertain' WHERE channel='discord' AND state='sending' AND id IN (SELECT job_id FROM jarvis_promotion_delivery WHERE claimed_at<?)",[now-120000]);await bank.query("UPDATE jarvis_promotion_jobs SET state='retry' WHERE channel='boards' AND state='sending' AND id IN (SELECT job_id FROM jarvis_promotion_delivery WHERE claimed_at<?)",[now-120000]);
|
||||
const rows=await bank.query("SELECT p.id job_id,p.channel,p.state job_state,l.*,d.reference_id,d.revision_hash,c.election_start campaign_end,c.kind campaign_kind,c.faction campaign_faction,j.expires_at job_end,j.source_term_id FROM jarvis_promotion_jobs p JOIN jarvis_listings l ON l.id=p.listing_id LEFT JOIN jarvis_promotion_delivery d ON d.job_id=p.id LEFT JOIN jarvis_campaign_bookings c ON c.id=l.id LEFT JOIN jarvis_political_jobs j ON j.listing_id=l.id WHERE p.state IN ('queued','retry','sent') AND p.next_attempt<=? ORDER BY p.next_attempt,p.created_at,p.id LIMIT 100",[now]);let sent=0,failed=0,attempted=0;
|
||||
for(const row of rows){if(attempted>=5)break;if(!channels.includes(row.channel))continue;let closed=row.state!=='open'||row.campaign_end!=null&&Number(row.campaign_end)<=now||row.job_end!=null&&Number(row.job_end)<=now;if(!closed&&row.source_term_id)closed=!await central.prepare("SELECT id FROM political_office_terms WHERE id=? AND outcome='winner' AND starts_at<=? AND expires_at>?").bind(row.source_term_id,now,now).first();const payload=promotionPayload(row,closed);if(row.revision_hash===payload.revision){await bank.query("UPDATE jarvis_promotion_jobs SET next_attempt=? WHERE id=? AND state='sent'",[now+60000,row.job_id]);continue;}if(closed&&!row.reference_id){await bank.query("UPDATE jarvis_promotion_jobs SET state='cancelled' WHERE id=? AND state IN ('queued','retry')",[row.job_id]);continue;}const token=randomUUID();
|
||||
const claimed=await bank.transaction(async tx=>{const job=await tx.first('SELECT state FROM jarvis_promotion_jobs WHERE id=? FOR UPDATE',[row.job_id]);if(!job||!['queued','retry','sent'].includes(job.state))return false;const delivered=await tx.first('SELECT reference_id,revision_hash FROM jarvis_promotion_delivery WHERE job_id=? FOR UPDATE',[row.job_id]);if(delivered?.revision_hash===payload.revision)return false;if(delivered?.reference_id)row.reference_id=delivered.reference_id;await tx.query("INSERT INTO jarvis_promotion_delivery(job_id,claim_token,claimed_at) VALUES(?,?,?) ON DUPLICATE KEY UPDATE claim_token=VALUES(claim_token),claimed_at=VALUES(claimed_at)",[row.job_id,token,now]);await tx.query("UPDATE jarvis_promotion_jobs SET state='sending',attempts=attempts+1 WHERE id=?",[row.job_id]);return true;});if(!claimed)continue;attempted++;
|
||||
|
|
@ -22,5 +24,5 @@ export function createPromotionDelivery(central,bank,{config=null,sendForum=nati
|
|||
export async function configurePromotionDelivery(central,bank,settings={},deps={}){
|
||||
let config=null,boards=false;try{const file=settings.DISCORD_STARPORT_CONFIG_FILE||'/home/dunerealms/.config/discord-starport.json';config=JSON.parse(await readFile(file,'utf8'));validateNewsWebhook(config,{channelId:STARPORT_CHANNEL});}catch{config=null;}
|
||||
try{boards=(await (deps.sendForum||nativePromotion)({action:'provision'})).ready===true;}catch{}
|
||||
return createPromotionDelivery(central,bank,{...deps,config,boards});
|
||||
return createPromotionDelivery(central,bank,{...deps,config,boards,serverEvents:true,edition:()=>currentCodexEdition(central,settings)});
|
||||
}
|
||||
|
|
|
|||
37
website/node/member-affiliations.mjs
Normal file
37
website/node/member-affiliations.mjs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import {PUBLIC_OFFICES} from './public-government.mjs';
|
||||
import {currentNaib} from './naib-membership.mjs';
|
||||
import {readOrganisationNetwork} from './organisation-network.mjs';
|
||||
const site='https://www.dunerealms.com',cp='https://cp.dunerealms.com';
|
||||
// Public membership is separate from ownership holdings and never grants rights.
|
||||
export async function readMemberAffiliations(db,target,{clan=null,politicalOffices=[],politicalAppointments=[]}={}){
|
||||
const records=new Map(),add=record=>records.set(record.type+':'+record.id,record);
|
||||
if(clan)add({id:clan.id,name:clan.name,type:'Clan',entityKind:'clan',url:site+'/clans/'+encodeURIComponent(clan.tag),emblem:cp+'/api/clan-emblems/'+encodeURIComponent(clan.id)});
|
||||
if(db.companyDeedsEnabled){
|
||||
const {results}=await db.prepare("SELECT DISTINCT c.id,c.name,c.slug FROM corrino_companies c LEFT JOIN site_company_deeds d ON d.company_id=c.id WHERE c.status='active' AND (d.owner_account_id=? OR c.ceo_account_id=? OR EXISTS(SELECT 1 FROM site_company_members m WHERE m.company_id=c.id AND m.user_id=?)) ORDER BY c.name,c.id").bind(target.id,target.id,target.id).all();
|
||||
for(const row of results)add({id:row.id,name:row.name,type:'Company',entityKind:'company',url:site+'/companies/'+encodeURIComponent(row.slug),emblem:cp+'/api/company-emblems/'+encodeURIComponent(row.id)});
|
||||
}
|
||||
const offices=new Set([...politicalOffices.map(o=>o.key),...politicalAppointments.map(a=>a.office_key)]);
|
||||
if(db.naibCouncilEnabled&&await currentNaib(db,target.id))offices.add('arrakis');
|
||||
for(const key of offices){const office=PUBLIC_OFFICES.find(o=>o.key===key);if(office)add({id:key,name:office.scope,type:'Political office',entityKind:'politics',url:site+'/political-houses/'+encodeURIComponent(key),emblem:site+'/assets/seals/'+office.art});}
|
||||
return {state:'available',records:[...records.values()]};
|
||||
}
|
||||
export async function readMemberAffiliationNetwork(db,target,affiliations,{clock=Date.now,readNetwork=readOrganisationNetwork}={}){
|
||||
const own=await readNetwork(db,{ownerId:target.id,clock}),nodes=new Map(own.network.nodes.map(n=>[n.id,n])),edges=new Map(),owners=new Set([own.ownerId]);
|
||||
const addEdge=edge=>edges.set(edge.from+'>'+edge.to,edge),person='person:'+target.username;
|
||||
for(const edge of own.network.edges)addEdge(edge);
|
||||
for(const record of affiliations.records){
|
||||
const kind=record.entityKind,nodeId=(kind==='politics'?'office':kind)+':'+record.id;
|
||||
if(['clan','company'].includes(kind)&&!nodes.has(nodeId)){
|
||||
const linked=await readNetwork(db,{kind,id:record.id,clock});owners.add(linked.ownerId);
|
||||
for(const node of linked.network.nodes)nodes.set(node.id,node);
|
||||
for(const edge of linked.network.edges)addEdge(edge);
|
||||
}
|
||||
if(!nodes.has(nodeId))nodes.set(nodeId,{id:nodeId,kind:kind==='politics'?'office':kind,name:record.name,url:record.url,image:record.emblem});
|
||||
if(!edges.has(person+'>'+nodeId))addEdge({from:person,to:nodeId,kind:'membership'});
|
||||
}
|
||||
const network={state:'available',...own.network,nodes:[...nodes.values()],edges:[...edges.values()],positions:owners.size===1?own.network.positions:{},readOnly:owners.size>1};
|
||||
// A combined membership view must not let the layout editor replace it with
|
||||
// another owner's editable projection. Existing ownership APIs stay unchanged.
|
||||
if(owners.size===1){const source=network.nodes.find(n=>['clan','company'].includes(n.kind));if(source)network.source={kind:source.kind,id:source.id.split(':').slice(1).join(':')};}
|
||||
return network;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import {readOrganisationNetwork} from './organisation-network.mjs';
|
||||
import {readMemberAffiliations,readMemberAffiliationNetwork} from './member-affiliations.mjs';
|
||||
import {readPersonalNetworth} from './personal-networth.mjs';
|
||||
import {activePoliticalAppointments} from './political-appointments.mjs';
|
||||
import {JARVIS_IDENTITY,isJarvisIdentity} from './jarvis-identity.mjs';
|
||||
|
|
@ -81,9 +81,11 @@ export async function memberProfileData(db,target,settings={}){
|
|||
const clan=await optional(()=>db.prepare('SELECT c.id,c.name,c.tag,c.description,m.clan_role,m.joined_at,(SELECT COUNT(*) FROM site_clan_members n WHERE n.clan_id=c.id) AS member_count FROM site_clan_members m JOIN site_clans c ON c.id=m.clan_id WHERE m.user_id=? AND c.active=1').bind(target.id).first(),undefined);
|
||||
const holdings=await optional(()=>memberHoldings(db,target),{state:'unavailable',clans:[],companies:[],appointments:[],deeds:[],subhouses:[],address:null});
|
||||
const officeHistory=await optional(async()=>({state:'available',records:(await db.prepare('SELECT kind,faction,office,starts_at,expires_at,outcome FROM political_office_terms WHERE user_id=? ORDER BY starts_at DESC,id DESC LIMIT 100').bind(target.id).all()).results}),{state:'unavailable',records:[]});
|
||||
let network={state:'unavailable'};if(db.networkLayoutsEnabled)try{const n=await readOrganisationNetwork(db,{ownerId:target.id,clock:settings.clock||Date.now});network={state:'available',...n.network};const entity=n.network.nodes.find(r=>['clan','company'].includes(r.kind));if(entity)network.source={kind:entity.kind,id:entity.id.split(':').slice(1).join(':')};}catch{}
|
||||
let network={state:'unavailable'};
|
||||
const networth=await optional(()=>readPersonalNetworth(settings.bankDatabase,target.id,{clock:settings.clock||Date.now}),{state:'unavailable',points:[]});const politicalAppointments=db.politicalAppointmentsEnabled?await activePoliticalAppointments(db,{userId:target.id,clock:settings.clock||Date.now}):[];
|
||||
return{network,networth,politicalAppointments:politicalAppointments.map(a=>({title:a.title,officeKey:a.office_key,expiresAt:Number(a.expires_at)})),projectIdentity:isJarvisIdentity(target)?'jarvis':null,officeHistory,holdings,characterName:target.display_name||target.username,politicalOffices,personnelNumber:await personnelNumberFor(db,target.id),showcase,memorial:memorial?'/memorial/'+memorial.slug:null,personalSeal:namedPersonal?medals.find(m=>m.key==='personal-role'):null,username:target.username,displayName:target.display_name,joinedAt:Number(target.created_at),functions:access.organisation?.assignments||[],avatar:'https://cp.dunerealms.com/api/avatars/face/member/'+encodeURIComponent(target.username),avatarMode:'image',bio:isJarvisIdentity(target)?JARVIS_IDENTITY.bio:publicProfile.bio,publicInfo:publicProfile.publicInfo,socials:publicProfile.socials,ranks,medals,forum:await publicForumFor(db,target.id),support:{status:staff?(stats?'available':'unavailable'):'not-staff',closed:stats?.totalClosed??null,departments:stats?.departments||{}},quests:{status:'placeholder',completed:null,active:null},clan:clan===undefined?{status:'unavailable'}:clan?{status:'member',id:clan.id,emblem:'https://cp.dunerealms.com/api/clan-emblems/'+clan.id,name:clan.name,tag:clan.tag,description:clan.description,role:clan.clan_role,joinedAt:Number(clan.joined_at),members:Math.max(0,Number(clan.member_count))}:{status:'none'}};
|
||||
const affiliations=await optional(()=>readMemberAffiliations(db,target,{clan:clan&&clan.id?clan:null,politicalOffices:politicalOffices.records||[],politicalAppointments}),{state:'unavailable',records:[]});
|
||||
if(db.networkLayoutsEnabled&&affiliations.state==='available')try{network=await readMemberAffiliationNetwork(db,target,affiliations,{clock:settings.clock||Date.now});}catch{network={state:'unavailable'};}
|
||||
return{affiliations,network,networth,politicalAppointments:politicalAppointments.map(a=>({title:a.title,officeKey:a.office_key,expiresAt:Number(a.expires_at)})),projectIdentity:isJarvisIdentity(target)?'jarvis':null,officeHistory,holdings,characterName:target.display_name||target.username,politicalOffices,personnelNumber:await personnelNumberFor(db,target.id),showcase,memorial:memorial?'/memorial/'+memorial.slug:null,personalSeal:namedPersonal?medals.find(m=>m.key==='personal-role'):null,username:target.username,displayName:target.display_name,joinedAt:Number(target.created_at),functions:access.organisation?.assignments||[],avatar:'https://cp.dunerealms.com/api/avatars/face/member/'+encodeURIComponent(target.username),avatarMode:'image',bio:isJarvisIdentity(target)?JARVIS_IDENTITY.bio:publicProfile.bio,publicInfo:publicProfile.publicInfo,socials:publicProfile.socials,ranks,medals,forum:await publicForumFor(db,target.id),support:{status:staff?(stats?'available':'unavailable'):'not-staff',closed:stats?.totalClosed??null,departments:stats?.departments||{}},quests:{status:'placeholder',completed:null,active:null},clan:clan===undefined?{status:'unavailable'}:clan?{status:'member',id:clan.id,emblem:'https://cp.dunerealms.com/api/clan-emblems/'+clan.id,name:clan.name,tag:clan.tag,description:clan.description,role:clan.clan_role,joinedAt:Number(clan.joined_at),members:Math.max(0,Number(clan.member_count))}:{status:'none'}};
|
||||
}
|
||||
export function createMemberProfiles(db,settings={}){return async request=>{
|
||||
const from=request.headers.get('origin');if(from&&from!==origin)return json({message:'Origin rejected.'},403);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue

Staff