From 0358190edfa4bca934efe32fafbd26cec1bf648f Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Sat, 28 Nov 2026 19:38:40 +0100 Subject: [PATCH] Restore the published Discover header and its guide pages --- website/scripts/build.mjs | 3 +- website/scripts/main-menu.mjs | 2 +- website/scripts/recipe-catalogue.mjs | 120 ++++++++++++++++ website/web/imperial-recipe-book.css | 89 ++++++++++++ website/web/imperial-recipe-book.html | 31 ++++ website/web/imperial-recipe-book.js | 134 ++++++++++++++++++ website/web/index.html | 4 +- website/web/lets-play.html | 63 ++++++++ .../web/recipe-icons/dune-crafting-panel.webp | Bin 0 -> 22738 bytes 9 files changed, 442 insertions(+), 4 deletions(-) create mode 100644 website/scripts/recipe-catalogue.mjs create mode 100644 website/web/imperial-recipe-book.css create mode 100644 website/web/imperial-recipe-book.html create mode 100644 website/web/imperial-recipe-book.js create mode 100644 website/web/lets-play.html create mode 100644 website/web/recipe-icons/dune-crafting-panel.webp diff --git a/website/scripts/build.mjs b/website/scripts/build.mjs index 9b309ed1..77aceccd 100644 --- a/website/scripts/build.mjs +++ b/website/scripts/build.mjs @@ -1,3 +1,4 @@ +import {recipeCatalogue,recipeIcons} from './recipe-catalogue.mjs'; import {applySharedHeader,applySharedFooter,SHARED_FOOTER_SCRIPT,cleanLegacyChromeScript,assertSharedChrome,sharedFooterBrandScript} from './site-chrome.mjs'; import {SHARED_HEADER} from './portal-navigation.mjs'; import {sharedHomepageHeaderScript} from './homepage-header.mjs'; @@ -56,7 +57,7 @@ publishExchangeAssets(path.join(root,'control-panel/public'),web); writeFileSync(path.join(web,'rates-and-charges.html'),applyRealmPageDesign(bankRatesPage(),'rates-and-charges.html')); let assetCount=0;let assetWriter=null,shardSize=0;const shardNames=[];let shardTemporary;function openShard(){shardTemporary=path.join(dist,'server','.assets-build-'+process.pid);assetWriter=openSync(shardTemporary,'w');writeSync(assetWriter,'export default {');shardSize=0;}function closeShard(){writeSync(assetWriter,'};\n');closeSync(assetWriter);const hash=createHash('sha256').update(readFileSync(shardTemporary)).digest('hex'),name='assets-'+hash+'.mjs',target=path.join(dist,'server',name);if(existsSync(target))unlinkSync(shardTemporary);else renameSync(shardTemporary,target);shardNames.push(name);}function writeAsset(entry){if(shardSize>32*1024*1024){closeShard();openShard();}writeSync(assetWriter,entry);shardSize+=Buffer.byteLength(entry);}const types={'.html':'text/html; charset=utf-8','.css':'text/css; charset=utf-8','.js':'text/javascript; charset=utf-8','.mjs':'text/javascript; charset=utf-8','.json':'application/json; charset=utf-8','.webp':'image/webp','.png':'image/png','.mp4':'video/mp4','.pdf':'application/pdf','.zip':'application/zip','.svg':'image/svg+xml'}; function collect(directory){for(const entry of readdirSync(directory).sort()){const p=path.join(directory,entry);if(statSync(p).isDirectory())collect(p);else{const relative=path.relative(web,p).split(path.sep).join('/');if(/^assets\/seals\/[^/]+-provenance\.txt$/.test(relative)||/^assets\/organisation-deed(?:s)?-[a-z0-9-]+\.png$/.test(relative))continue;const type=types[path.extname(entry)];if(!type)throw Error('Unexpected asset: '+entry);const bytes=readFileSync(p);const payload=relative.endsWith('.html')?Buffer.from(preparePublicHtml(bytes.toString('utf8'),relative)):relative==='realm-design.js'?Buffer.from(sharedRealmRuntime):relative==='realm-design.css'?sharedRealmCSS:relative==='portal-navigation.js'?Buffer.from(SHARED_FOOTER_SCRIPT+withRealmSwitch(withCanonicalMenu(withMenuBadges(cleanLegacyChromeScript(bytes.toString('utf8')))))+sharedRealmRuntime):relative==='portal-navigation.css'?Buffer.concat([bytes,Buffer.from(HOUSE_STYLE_CSS+REALM_SWITCH_CSS+readFileSync(path.join(web,"realm-comfort.css"),"utf8"))]):bytes;writeAsset(JSON.stringify('/'+relative)+':['+JSON.stringify(type)+','+JSON.stringify(payload.toString('base64'))+'],');assetCount++}}} -mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'.openai'),{recursive:true});const workerTemporary=path.join(dist,'server/index.js.build-'+process.pid);process.once('exit',()=>{if(existsSync(workerTemporary))try{unlinkSync(workerTemporary);}catch{}});openShard();collect(web);const buildCommit=process.env.GITHUB_SHA;if(buildCommit&&/^[0-9a-f]{40}$/.test(buildCommit)){writeAsset(JSON.stringify('/ci-build.json')+':'+JSON.stringify(['application/json; charset=utf-8',Buffer.from(JSON.stringify({commit:buildCommit})).toString('base64')])+',');}closeShard(); +mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'.openai'),{recursive:true});const workerTemporary=path.join(dist,'server/index.js.build-'+process.pid);process.once('exit',()=>{if(existsSync(workerTemporary))try{unlinkSync(workerTemporary);}catch{}});openShard();collect(web);const recipes=recipeCatalogue();for(const [url,image] of recipeIcons(recipes)){writeAsset(JSON.stringify(url)+":"+JSON.stringify(["image/png",image.toString("base64")])+",");assetCount++;}writeAsset(JSON.stringify('/recipe-catalogue.json')+':['+JSON.stringify(types['.json'])+','+JSON.stringify(Buffer.from(JSON.stringify(recipes)).toString('base64'))+'],');assetCount++;const buildCommit=process.env.GITHUB_SHA;if(buildCommit&&/^[0-9a-f]{40}$/.test(buildCommit)){writeAsset(JSON.stringify('/ci-build.json')+':'+JSON.stringify(['application/json; charset=utf-8',Buffer.from(JSON.stringify({commit:buildCommit})).toString('base64')])+',');}closeShard(); let api=['public-item-metadata.mjs','feed-api.mjs','exchange-api.mjs','forum-api.mjs','community-api.mjs','portal-api.mjs'].map(file=>readFileSync(path.join(root,'worker',file),'utf8').replace(/^import .*;$/gm,'').replace(/export /g,'')).join('\n');let runtime=readFileSync(path.join(root,'worker/runtime.mjs'),'utf8').replace(/^import .*;$/gm,''); writeFileSync(path.join(dist,'server/index.js'),shardNames.map((name,i)=>'import DATA'+i+' from '+JSON.stringify('./'+name)+';').join('\n')+'\nconst ASSET_DATA=Object.assign({},'+shardNames.map((_,i)=>'DATA'+i).join(',')+');\n'+api+'\n'+runtime);cpSync(path.join(root,'.openai/hosting.json'),path.join(dist,'.openai/hosting.json'));console.log('Built Worker with',assetCount,'embedded website assets'); if(existsSync(path.join(root,'drizzle')))cpSync(path.join(root,'drizzle'),path.join(dist,'.openai/drizzle'),{recursive:true}); diff --git a/website/scripts/main-menu.mjs b/website/scripts/main-menu.mjs index b1e00c85..dbdee7f7 100644 --- a/website/scripts/main-menu.mjs +++ b/website/scripts/main-menu.mjs @@ -1,5 +1,5 @@ export const MAIN_MENU=[["Home","https://www.dunerealms.com/","nav-home-v2.webp"],["Discover","https://wiki.dunerealms.com/","nav-manual-v2.webp"],["Community","https://forums.dunerealms.com/","nav-boards-v2.webp"],["Trade","https://www.dunerealms.com/exchange.html","nav-exchange-v2.webp"],["The realm","https://www.dunerealms.com/realm-hub.html","nav-clan-v2.webp"],["My Account","https://cp.dunerealms.com/","nav-account-v2.webp"]]; -export const MAIN_MENU_GROUPS={"Discover":[["Explore worlds","https://www.dunerealms.com/#worlds","nav-home-v2.webp"],["New player guide","https://wiki.dunerealms.com/","nav-manual-v2.webp"]],"Community":[["Forums","https://forums.dunerealms.com/","nav-boards-v2.webp"],["Discord","https://www.dunerealms.com/discord.html","nav-discord-v2.webp"],["People of the realm","https://www.dunerealms.com/staff.html","nav-staff-v2.webp"],["News & updates","https://www.dunerealms.com/news-archive.html","nav-boards-v2.webp"],["Events","https://cp.dunerealms.com/#events/events-calendar","nav-home-v2.webp"],["Latest bans & appeals","https://www.dunerealms.com/community-records.html","nav-support-v2.webp"]],"Trade":[["Player Exchange","https://www.dunerealms.com/exchange.html","nav-exchange-v2.webp"],["Equipment & kits","https://www.dunerealms.com/exchange.html?type=kits","imperial-atelier-v1.webp"],["Imperial Postbank","https://cp.dunerealms.com/#bank/bank-overview","imperial-postbank-v2.png"],["Community shop","https://shop.dunerealms.com/","nav-shop-v1.webp"]],"The realm":[["Clans","https://www.dunerealms.com/realm-hub.html#clan","nav-clan-v2.webp"],["Companies","https://www.dunerealms.com/realm-hub.html#company","exchange-company-jobs-v1.png"],["Politics & offices","https://www.dunerealms.com/realm-hub.html#politics","seals/office-landsraad.png"]],"My Account":[["My dashboard","https://cp.dunerealms.com/","nav-account-v2.webp"],["Mail","https://cp.dunerealms.com/#post/mail-inbox","nav-support-v2.webp"],["Quests","https://clans.dunerealms.com/#quests/quests","exchange-quests-v1.png"],["Support","https://support.dunerealms.com/","nav-support-v2.webp"],["Staff sign in","https://cp.dunerealms.com/#bureau/user-management","nav-staff-v2.webp"]]}; +export const MAIN_MENU_GROUPS={"Discover":[["Explore worlds","https://www.dunerealms.com/#worlds","nav-home-v2.webp"],["Let’s Play Manual","https://www.dunerealms.com/lets-play.html","nav-manual-v2.webp"],["Imperial Recipe Book","https://www.dunerealms.com/imperial-recipe-book.html","nav-manual-v2.webp"]],"Community":[["Forums","https://forums.dunerealms.com/","nav-boards-v2.webp"],["Discord","https://www.dunerealms.com/discord.html","nav-discord-v2.webp"],["People of the realm","https://www.dunerealms.com/staff.html","nav-staff-v2.webp"],["News & updates","https://www.dunerealms.com/news-archive.html","nav-boards-v2.webp"],["Events","https://cp.dunerealms.com/#events/events-calendar","nav-home-v2.webp"],["Latest bans & appeals","https://www.dunerealms.com/community-records.html","nav-support-v2.webp"]],"Trade":[["Player Exchange","https://www.dunerealms.com/exchange.html","nav-exchange-v2.webp"],["Equipment & kits","https://www.dunerealms.com/exchange.html?type=kits","imperial-atelier-v1.webp"],["Imperial Postbank","https://cp.dunerealms.com/#bank/bank-overview","imperial-postbank-v2.png"],["Community shop","https://shop.dunerealms.com/","nav-shop-v1.webp"]],"The realm":[["Clans","https://www.dunerealms.com/realm-hub.html#clan","nav-clan-v2.webp"],["Companies","https://www.dunerealms.com/realm-hub.html#company","exchange-company-jobs-v1.png"],["Politics & offices","https://www.dunerealms.com/realm-hub.html#politics","seals/office-landsraad.png"]],"My Account":[["My dashboard","https://cp.dunerealms.com/","nav-account-v2.webp"],["Mail","https://cp.dunerealms.com/#post/mail-inbox","nav-support-v2.webp"],["Quests","https://clans.dunerealms.com/#quests/quests","exchange-quests-v1.png"],["Support","https://support.dunerealms.com/","nav-support-v2.webp"],["Staff sign in","https://cp.dunerealms.com/#bureau/user-management","nav-staff-v2.webp"]]}; export const menuLeafLinks=rows=>rows.flatMap(row=>Array.isArray(row[3])?menuLeafLinks(row[3]):[row]); export const ALL_MENU_LINKS=[...MAIN_MENU,...menuLeafLinks(Object.values(MAIN_MENU_GROUPS).flat())].filter((row,i,rows)=>rows.findIndex(r=>r[1]===row[1])===i); export function canonicalMenuHref(value){const u=new URL(value,'https://www.dunerealms.com');if(u.hostname==='dunerealms.com')u.hostname='www.dunerealms.com';if(u.hostname==='www.dunerealms.com'&&/^\/(manual|wiki)\.html$/.test(u.pathname))return'https://wiki.dunerealms.com/';if(u.hostname==='cp.dunerealms.com'&&u.pathname==='/'){if(u.hash==='#shop')return'https://shop.dunerealms.com/';if(u.hash==='#exchange')return'https://www.dunerealms.com/exchange.html';}if(['forums','support','cp','clans','corp','wiki'].some(h=>u.hostname===h+'.dunerealms.com'))return u.origin+'/';const kits=u.pathname==='/exchange.html'&&/^kits(?:-(?:clan|office|player|legendary))?$/.test(u.searchParams.get('type')||'');return u.origin+(u.pathname==='/index.html'?'/':u.pathname)+(kits?'?type=kits':'');} diff --git a/website/scripts/recipe-catalogue.mjs b/website/scripts/recipe-catalogue.mjs new file mode 100644 index 00000000..1b8c9ddf --- /dev/null +++ b/website/scripts/recipe-catalogue.mjs @@ -0,0 +1,120 @@ +import { existsSync, readdirSync, readFileSync } from 'node:fs'; + +const source = new URL('../../DuneRealmsGUI/executablecrafting/recipes/', import.meta.url); +const smoker = new URL('../../JarvisConnector/src/main/resources/survival-food-recipes.json', import.meta.url); + +const repairParts = new URL('../../DuneTerrain/src/main/resources/starter-repair-parts.json', import.meta.url); +const arrakisItems = new URL('../../DuneRealmsGUI/executableitems/arrakis/', import.meta.url); +const vanillaFoodSaturation = { beef: 1.8, enchanted_golden_apple: 9.6 }; +const itemSummaries = { + bio_paste: 'A concentrated blend of Spice Paste and Rehydrated Steak. Process it in a smoker to make Spice Bread.', + chukka_cooked_meat: 'Cooked meat from an Arrakis Chukka. Eat it to restore hunger and saturation.', + contaminated_spice_block: 'A block made by packing nine portions of contaminated spice together.', + dunesponge: 'A spice-treated sponge that can pick up one water source and place it elsewhere on Arrakis.', + jerboa_cooked_meat: 'Cooked meat from an Arrakis Jerboa. Eat it to restore hunger and saturation, or use it in Jerboa Stew.', + jerboa_hide_paste: 'Prepared Jerboa hide. Smoke it to make Jerboa Leather, or combine it with Melange to make a Weirding Module.', + jerboa_stew: 'A prepared meal made with Jerboa meat. Eat it to restore hunger and saturation.', + farmers_bucket: 'A one-use bucket for placing water on Arrakis.', + rehydrated_steak: 'Meat rehydrated with water. Eat it or combine it with Spice Paste to make Bio Paste.', + spice_cake: 'A finished spice food. Eat it to restore hunger and saturation.', + spice_dough: 'A prepared spice mixture used to make Spice Cake.', + spice_paste: 'A concentrated mix of Melange Spice and acacia. Use it to prepare Bio Paste.', + jerboa_egg: 'A throwable Weirding Module. It produces a harmful splash and smoke when it strikes a target.', + jerboa_leather: 'Leather made by processing Jerboa Hide Paste in a smoker.', + spice_bread: 'Food made by smoking Bio Paste. Eat it to restore hunger and saturation.', + 'starter-repair-plate-v1': 'A starter equipment repair part used to restore protective plates.', + 'starter-binding-patch-v1': 'A leather repair part used to patch worn stillsuit fabric.', + 'starter-tool-fitting-v1': 'A copper repair part used to replace worn equipment fittings.', + 'starter-calibration-piece-v1': 'A quartz repair part used to calibrate repaired suit systems.', + spice_block: 'Nine portions of Melange compressed into one block for storage and transport.', + smuggled_spice_block: 'Nine portions of Smuggled Spice compressed into one block. The block retains its smuggled origin.', + crafted_elytra: 'A pair of wings worn in the chest slot. Use them to glide.', + jerboa_water_vial: 'A portable supply of water. Use it in recipes or to fill a cauldron on Arrakis.', + water_of_life: 'A rare result of brewing a Blood Vial with spice. Drinking it can grant temporary combat effects, with a 1% chance of death.', + spice_boosted_potion: 'An imported potion enhanced with spice on Arrakis. Drink it for stronger effects where the rounded effect level increases.', +}; +const foodIds = new Set(['chukka_cooked_meat', 'jerboa_cooked_meat', 'jerboa_stew', 'rehydrated_steak', 'spice_bread', 'spice_cake']); +const ecologyIcons = new URL('../../DuneRealmsGUI/ecology/food-icons/', import.meta.url); + +function entry(id, name, material = id, custom = false) { + return { id, name, material, custom }; +} + +function item(command) { + const material = command.match(/^minecraft:([a-z0-9_]+)/)?.[1]; + if (!material) throw Error('Unrecognised recipe item ' + command); + const custom = command.match(/"executableitems:ei-id":"([^"]+)"/)?.[1]; + const name = command.match(/minecraft:custom_name=\{"text":"([^"]+)"/)?.[1] + ?? material.replaceAll('_', ' ').replace(/\b\w/g, letter => letter.toUpperCase()); + const result = entry(custom ?? material, name, material, Boolean(custom)); + const quality = command.match(/"dunerealms:quality":"([a-z_]+)"/)?.[1]; + const mark = command.match(/"dunerealms:equipment_mark":"(\d+)"/)?.[1]; + const lore = command.match(/minecraft:lore=(\[[^\]]*\])/); + if (quality) result.quality = quality; + if (mark) result.equipmentMark = Number(mark); + if (lore) result.lore = JSON.parse(lore[1]).map(line => line.text).filter(line => !/ \| MK /.test(line)); + return result; +} + +export function recipeCatalogue() { + const recipes = []; + const spice = entry('spice', 'Melange Spice', 'orange_dye', true); + const requiresSpice = new Set(['dunesponge.yml', 'spice_paste.yml', 'spice_dough.yml', 'weirding_module.yml']); + for (const file of readdirSync(source).filter(name => name.endsWith('.yml')).sort()) { + const recipe = JSON.parse(readFileSync(new URL(file, source), 'utf8')); + const station = recipe.recipeType === 'FURNACE' ? 'Furnace' : 'Crafting table'; + if (recipe.recipeType !== 'FURNACE' && recipe.typeOfCraftingTableRecipe !== 'SHAPELESS') { + throw Error('Unsupported recipe layout in ' + file); + } + const inputs = Object.entries(recipe) + .filter(([key]) => /^input\d+$/.test(key)) + .sort(([a], [b]) => Number(a.slice(5)) - Number(b.slice(5))) + .map(([, command]) => command === 'minecraft:orange_dye' && requiresSpice.has(file) ? spice : item(command)); + recipes.push({ id: file.slice(0, -4), station, inputs, output: item(recipe.result), amount: recipe.resultAmount ?? 1 }); + } + for (const recipe of JSON.parse(readFileSync(smoker, 'utf8')).smoker) { + const output = recipes.find(entry => entry.output.id === recipe.result)?.output + ?? entry(recipe.result, recipe.result.replaceAll('_', ' ').replace(/\b\w/g, letter => letter.toUpperCase()), recipe.result === 'spice_bread' ? 'bread' : 'leather', true); + recipes.push({ id: recipe.id + '-smoker', station: 'Smoker', inputs: [item(recipe.inputCommand)], output, amount: recipe.amount }); + } + const smuggled = entry('smuggled_spice', 'Smuggled Spice', 'orange_dye', true); + const crafting = 'Crafting table'; + for (const part of JSON.parse(readFileSync(repairParts, 'utf8'))) { + const ingredient = item(part.material.toLowerCase()); + recipes.push({ id: part.id, station: crafting, inputs: [ingredient, spice], output: { ...entry(part.id, part.name, ingredient.material, true), quality: "uncommon", equipmentMark: 1, lore: [part.purpose] }, amount: 1, notes: part.purpose + ' Genuine Melange or Smuggled Spice works.' }); + } + for (const [id, name, ingredient] of [['spice_block', 'Spice Block', spice], ['smuggled_spice_block', 'Smuggled Spice Block', smuggled]]) { + recipes.push({ id, station: crafting, inputs: Array(9).fill(ingredient), output: entry(id, name, 'dried_kelp_block', true), amount: 1, shaped: true, notes: 'Fill all nine slots with the same kind of genuine spice.' }); + } + const flight = ['netherite_ingot', 'phantom_membrane', 'netherite_ingot', 'iron_ingot', 'diamond', 'iron_ingot', 'copper_ingot', 'phantom_membrane', 'copper_ingot'].map(material => item('minecraft:' + material)); + recipes.push({ id: 'crafted_elytra', station: crafting, inputs: flight, output: entry('crafted_elytra', 'Elytra', 'elytra', true), amount: 1, shaped: true }); + const water = entry('jerboa_water_vial', 'Vial of Water', 'potion', true); + const blood = entry('blood_vial', 'Blood Vial', 'potion', true); + const life = entry('water_of_life', 'Water of Life', 'potion', true); + recipes.push({ id: 'imported_water_vials', station: crafting, inputs: [entry('imported_water_bucket', 'Imported Water Bucket', 'water_bucket')], output: water, amount: 6, notes: 'Craft on Arrakis using a water bucket sourced from another world.' }); + const brew = 'On Arrakis, brew genuine spice with a Blood Vial. Per vial: 50% Vial of Water, 5% Water of Life, 45% no output.'; + recipes.push({ id: 'brew_water_vial', station: 'Brewing stand', inputs: [blood, spice], output: water, amount: 1, possible: true, notes: brew }); + recipes.push({ id: 'brew_water_of_life', station: 'Brewing stand', inputs: [blood, spice], output: life, amount: 1, possible: true, notes: brew + ' Drinking Water of Life has a 1% fatal chance.' }); + recipes.push({ id: 'spice_boosted_potion', station: 'Brewing stand', inputs: [entry('imported_potion', 'Imported Potion', 'potion'), spice], output: entry('spice_boosted_potion', 'Spice-Boosted Potion', 'potion', true), amount: 1, notes: 'Brew once on Arrakis. Effect levels are multiplied by 1.25 and rounded to the nearest whole level; duration stays the same.' }); + for (const recipe of recipes) { + if (foodIds.has(recipe.output.id)) { + const definition = JSON.parse(readFileSync(new URL(recipe.output.id + '.yml', arrakisItems), 'utf8')); + const material = definition.material.toLowerCase(); + const saturation = definition.foodFeatures?.saturation ?? vanillaFoodSaturation[material]; + if (!Number.isFinite(saturation)) throw Error('Missing saturation for ' + recipe.output.id); + recipe.output = { ...recipe.output, material, stats: [{ label: 'Saturation per serving', value: '+' + saturation + ' points' }] }; + } + const summary = itemSummaries[recipe.output.id]; + if (!summary) throw Error('Missing item summary for ' + recipe.output.id); + recipe.output = { ...recipe.output, summary }; + for (const ingredient of [...recipe.inputs, recipe.output]) { + if (ingredient.custom && existsSync(new URL(ingredient.id + '.png', ecologyIcons))) ingredient.icon = '/recipe-icons/' + ingredient.id + '.png'; + } + } + return recipes; +} + +export function recipeIcons(recipes) { + const icons = new Set(recipes.flatMap(recipe => [...recipe.inputs, recipe.output]).map(item => item.icon).filter(Boolean)); + return [...icons].map(path => [path, readFileSync(new URL(path.split('/').at(-1), ecologyIcons))]); +} diff --git a/website/web/imperial-recipe-book.css b/website/web/imperial-recipe-book.css new file mode 100644 index 00000000..c62c1ba1 --- /dev/null +++ b/website/web/imperial-recipe-book.css @@ -0,0 +1,89 @@ +.realm-handbook{max-width:1240px;margin:0 auto;padding:clamp(16px,4vw,48px);color:#f4e6c5} +.handbook-intro{padding:clamp(20px,5vw,54px);border:1px solid #a98b50;border-radius:12px;background:linear-gradient(90deg,#0b221fee,#0b221fa6),url('/assets/arrakis.webp') center/cover;margin-bottom:24px} +.handbook-intro h1{font-size:clamp(2rem,6vw,4rem);margin:0 0 .4em}.handbook-intro a,.manual-jump a,.recipe-notes a,.player-manual section a{color:#efd193} +.recipe-layout{display:grid;grid-template-columns:minmax(175px,235px) minmax(0,1fr);gap:22px} +.recipe-index{align-self:start;border:1px solid #8f753f;background:#102a23;border-radius:10px;padding:15px} +.recipe-index label,.recipe-index input{display:block;width:100%;margin-bottom:9px}.recipe-index input{box-sizing:border-box;padding:9px;border:1px solid #ad9158;background:#091e19;color:#fff4d5;border-radius:5px} +.recipe-index h2{margin:16px 0 4px;font-size:1rem;color:#e8c479}.recipe-index a{display:block;padding:6px;color:#f5e7c4}.recipe-index a[aria-current]{background:#2a4738;border-radius:4px} +.recipe-spread{display:grid;grid-template-columns:1fr 1fr;border:9px solid #473322;border-radius:14px;overflow:hidden;box-shadow:0 10px 18px #0005} +.recipe-sheet{padding:clamp(16px,4vw,36px);background:linear-gradient(105deg,#ead9aa,#f5e7bd);color:#34251b;min-width:0}.recipe-sheet+.recipe-sheet{border-left:2px solid #b89b66;background:linear-gradient(90deg,#cfb783,#f5e7bd 15%)} +.recipe-sheet h2,.recipe-sheet a{color:#493322}.recipe-sheet li{margin:.5em 0} +.recipe-grid{padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;list-style:none}.recipe-grid li{display:grid;place-items:center;min-height:46px;margin:0;padding:3px;background:#d6be8e;border:1px solid #a78656;text-align:center;font-size:.74rem;overflow-wrap:anywhere}.recipe-grid img{width:26px;height:26px;image-rendering:pixelated;object-fit:contain} +.recipe-notes,.player-manual section{background:#102a23;border:1px solid #927a47;padding:clamp(16px,4vw,30px);border-radius:10px;margin-top:20px}.manual-jump{display:flex;gap:16px;flex-wrap:wrap}.player-manual code{color:#ffdc91;white-space:normal} +@media(max-width:740px){.recipe-layout,.recipe-spread{grid-template-columns:1fr}.recipe-sheet+.recipe-sheet{border-left:0;border-top:2px solid #b89b66}} + +#recipe-output{display:flex;align-items:center;gap:9px} +#recipe-output img{width:34px;height:34px;object-fit:contain;image-rendering:pixelated} +#recipe-name:focus-visible{outline:2px solid #715831;outline-offset:4px} + +.recipe-manual-link{margin:0 0 18px;text-align:right} +.recipe-index{display:block} +.recipe-index input{min-width:0;max-width:100%} +.recipe-index #recipe-index h2{font-size:1rem;margin:12px 0 2px} +.recipe-index #recipe-index a{padding:3px 6px} +#recipe .recipe-sheet,#recipe .recipe-sheet :is(h2,p,li,span,a){color:#392619!important} +#recipe .recipe-sheet a{text-decoration:underline;text-underline-offset:2px} + +#recipe-station{display:flex;align-items:center;gap:9px}#recipe-station img{width:28px;height:28px;object-fit:contain;image-rendering:pixelated} + +#recipe-station-layout{display:grid;grid-template-columns:minmax(0,1fr) clamp(14px,6%,32px) minmax(36px,1fr);gap:clamp(6px,2vw,20px);align-items:center;width:min(100%,360px);padding:clamp(7px,2vw,17px);border:2px solid #65482e;border-radius:5px;background:#c6c4b7;box-shadow:inset 2px 2px #eeead5,inset -2px -2px #858176;box-sizing:border-box} +#recipe-station-layout.recipe-station--crafting{grid-template-columns:minmax(0,3fr) clamp(14px,8%,32px) minmax(32px,1fr)} +#recipe-grid{grid-template-columns:repeat(auto-fit,minmax(28px,1fr));gap:2px;margin:0} +.recipe-station--crafting #recipe-grid{grid-template-columns:repeat(3,minmax(0,1fr));} +#recipe-grid li,#recipe-result{box-sizing:border-box;display:grid;place-items:center;aspect-ratio:1;min-height:0;margin:0;padding:2px;border:0;background:#8e8d82;box-shadow:inset 2px 2px #53524a,inset -2px -2px #efebdb} +#recipe-grid li[aria-label="Empty slot"]{background:#85847a} +#recipe-grid li>a{display:grid;place-items:center;width:100%;height:100%} +#recipe-grid img,#recipe-result img{width:min(85%,38px);height:auto;aspect-ratio:1;object-fit:contain;image-rendering:pixelated} +.recipe-arrow{width:100%;aspect-ratio:1;background:#675f4e;clip-path:polygon(0 39%,58% 39%,58% 14%,100% 50%,58% 86%,58% 61%,0 61%)} + +#recipe-station-layout.recipe-station--cooking{grid-template-columns:minmax(28px,42px) clamp(14px,8%,32px) minmax(36px,50px);justify-content:center} +.recipe-station--cooking #recipe-grid{grid-template-columns:1fr} +.recipe-station--cooking #recipe-grid .recipe-heat{width:66%;justify-self:center;aspect-ratio:1.8;background:linear-gradient(#edb445,#af622a);box-shadow:none;clip-path:polygon(0 100%,10% 45%,26% 69%,39% 12%,53% 62%,74% 24%,100% 100%)} + +#recipe-station-layout{margin:14px auto 0;border-color:#705338;box-shadow:inset 2px 2px #eeead5,inset -2px -2px #858176,0 4px 10px #41280f36} +#recipe-output{justify-content:center;text-align:center} +#recipe-result{outline:1px solid #8d693b;outline-offset:2px} +#recipe-grid li>a:focus-visible{outline:2px solid #ffe1a2;outline-offset:-2px} + +#recipe-item-card{margin-top:20px} +#recipe-item-card .item-lore-card{max-width:100%} + +#recipe-station-layout{background:#2e2317 url('/recipe-icons/dune-crafting-panel.webp') center/100% 100% no-repeat;border-color:#7f5e32;box-shadow:0 4px 12px #34231466;padding:clamp(10px,2.6vw,24px)} +#recipe-grid li,#recipe-result{background:#23463c;box-shadow:inset 2px 2px #142820,inset -1px -1px #a7834b} +#recipe-grid li[aria-label="Empty slot"]{background:#172c27d9} +#recipe-result{outline-color:#d9ae61} +.recipe-arrow{background:#dcaf64} +#recipe-ingredients{padding:0;list-style:none} +#recipe-ingredients li{display:grid;grid-template-columns:max-content minmax(0,1fr) 26px;align-items:center;gap:8px} +.ingredient-icon{width:26px;height:26px;display:grid;place-items:center} +.ingredient-icon img{width:100%;height:100%;object-fit:contain;image-rendering:pixelated} +.ingredient-quantity{white-space:nowrap} + +#recipe-ingredients{padding:6px 14px;border:1px solid #b39155;border-radius:5px;background:#fff4d440;box-shadow:inset 0 0 0 2px #faedca} +#recipe-ingredients li{margin:0;padding:9px 0} +#recipe-ingredients li+li{border-top:1px solid #b3915566} + +.guide-layout{display:grid;grid-template-columns:minmax(180px,240px) minmax(0,1fr);gap:clamp(18px,3vw,36px);align-items:start} +.guide-index{padding:18px;border:1px solid #886f3e;border-radius:7px;background:#142f27} +.guide-index h2{margin:0 0 12px;font-size:1.2rem} +.guide-index ol{margin:0;padding:0 0 0 1.4rem;color:#dcb977} +.guide-index li{padding:4px 0} +.guide-index a{color:#f0dfb7} +.guide-index .guide-book-link{display:flex;align-items:center;gap:9px;margin-top:15px;padding-top:12px;border-top:1px solid #78633c} +.guide-chapters{display:grid;gap:20px;min-width:0} +.player-manual .guide-chapter{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,3fr);min-height:192px;padding:0;margin:0;overflow:hidden;scroll-margin-top:20px;border-radius:7px;background:linear-gradient(135deg,#1d3a2c,#102921)} +.guide-chapter-art{display:grid;position:relative;overflow:hidden;isolation:isolate;min-height:150px} +.guide-chapter-art img{width:100%;height:100%;position:absolute;inset:0;object-fit:cover} +.guide-chapter-art::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent 75%,#17322640)} +.guide-chapter-portrait{background:radial-gradient(ellipse at center,#66502e,#10261f)} +.guide-chapter-portrait img{object-fit:contain;padding:12px;box-sizing:border-box} +.guide-chapter-copy{padding:clamp(18px,3vw,30px);align-self:center} +.guide-chapter-copy h2{margin:0 0 10px;font-size:clamp(21px,2vw,30px)} +.guide-chapter-copy p{margin:0 0 12px} +.guide-action{display:inline-flex;align-items:center;gap:8px;border-bottom:1px solid #aa8950;padding:0 0 3px} +@media(max-width:740px){.guide-layout,.player-manual .guide-chapter{grid-template-columns:1fr}.guide-index ol{display:flex;flex-wrap:wrap;gap:0 24px;padding-left:18px}.guide-chapter-art{min-height:170px}.guide-chapter-portrait img{padding:4px}} + +.recipe-item-info{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);align-items:start;gap:clamp(20px,4vw,44px);margin-top:20px;padding:clamp(18px,4vw,32px);border:1px solid #927a47;border-radius:10px;background:linear-gradient(140deg,#1b372a,#10271f)} +.recipe-item-info h2{margin-top:0} +.recipe-item-info #recipe-item-card{margin:0;min-width:0} +@media(max-width:740px){.recipe-item-info{grid-template-columns:1fr}} diff --git a/website/web/imperial-recipe-book.html b/website/web/imperial-recipe-book.html new file mode 100644 index 00000000..e7c03da5 --- /dev/null +++ b/website/web/imperial-recipe-book.html @@ -0,0 +1,31 @@ + + + + +Imperial Recipe Book · DuneRealms + + + + +
+
+ +
+ +
+

Loading recipes…

+ +
+
+
+ + diff --git a/website/web/imperial-recipe-book.js b/website/web/imperial-recipe-book.js new file mode 100644 index 00000000..79503511 --- /dev/null +++ b/website/web/imperial-recipe-book.js @@ -0,0 +1,134 @@ +import { itemLoreCard } from './item-lore-view.mjs'; +const get = id => document.getElementById(id); +const node = (tag, text) => Object.assign(document.createElement(tag), { textContent: text }); +const link = (recipe, name = recipe.output.name) => + Object.assign(node('a', name), { href: '?recipe=' + encodeURIComponent(recipe.id) }); + +try { + const response = await fetch('/recipe-catalogue.json'); + if (!response.ok) throw Error('Recipe catalogue unavailable'); + const recipes = await response.json(); + const items = new Map(); + for (const recipe of recipes) { + if (!items.has(recipe.output.id)) items.set(recipe.output.id, recipe); + } + const indexRecipes = [...items.values()].sort((a, b) => a.output.name.localeCompare(b.output.name)); + const search = get('recipe-search'); + let selected; + + function renderIndex() { + const query = search.value.trim().toLowerCase(); + const index = get('recipe-index'); + index.replaceChildren(); + let previous; + for (const recipe of indexRecipes.filter(entry => entry.output.name.toLowerCase().includes(query))) { + const letter = recipe.output.name[0].toUpperCase(); + if (previous !== letter) index.append(node('h2', letter)); + previous = letter; + const anchor = link(recipe); + if (recipe.output.id === selected.output.id) anchor.setAttribute('aria-current', 'page'); + index.append(anchor); + } + if (!index.childElementCount) index.append(node('p', 'No recipes match your search.')); + } + + function label(item) { + const recipe = items.get(item.id); + return recipe && item.id !== selected.output.id ? link(recipe, item.name) : node('span', item.name); + } + + function icon(item) { + const image = document.createElement('img'); + image.src = item.icon ?? '/assets/minecraft-items/' + item.material + '.png'; + image.alt = ''; + image.addEventListener('error', () => image.remove(), { once: true }); + return image; + } + + function render(id) { + selected = recipes.find(recipe => recipe.id === id) ?? indexRecipes[0]; + if (!selected) throw Error('No recipes'); + renderIndex(); + const ingredients = new Map(); + for (const item of selected.inputs) { + const row = ingredients.get(item.id) ?? { item, count: 0 }; + row.count++; + ingredients.set(item.id, row); + } + get('recipe-ingredients').replaceChildren(...[...ingredients.values()].map(({ item, count }) => { + const row = node('li', ''); + const artwork = node('span', ''); artwork.className = 'ingredient-icon'; artwork.append(icon(item)); + const quantity = node('span', count + ' ×'); quantity.className = 'ingredient-quantity'; + row.append(quantity, label(item), artwork); + return row; + })); + + get('recipe-name').textContent = selected.output.name; + const station = { 'Crafting table': 'crafting_table', Furnace: 'furnace', Smoker: 'smoker', 'Brewing stand': 'brewing_stand' }[selected.station]; + get('recipe-station').replaceChildren(icon({ material: station }), node('span', 'Use a ' + selected.station.toLowerCase() + '.')); + get('recipe-result').replaceChildren(icon(selected.output)); + get('recipe-result').setAttribute('aria-label', selected.output.name); + const card = itemLoreCard({ ...selected.output, nativeMetadata: true }); + if (selected.output.icon) card.querySelector('.item-lore-name img').src = selected.output.icon; + get('recipe-item-summary').textContent = selected.output.summary; + get('recipe-item-card').replaceChildren(card); + get('recipe-output').textContent = (selected.possible ? 'Possible result' : 'Makes') + ' · ' + selected.amount + ' × ' + selected.output.name; + const crafting = selected.station === 'Crafting table'; + const cooking = selected.station === 'Furnace' || selected.station === 'Smoker'; + get('recipe-station-layout').classList.toggle('recipe-station--crafting', crafting); + get('recipe-station-layout').classList.toggle('recipe-station--cooking', cooking); + const slots = crafting ? Array.from({ length: 9 }, (_, index) => selected.inputs[index]) : selected.inputs; + get('recipe-grid').replaceChildren(...slots.map(item => { + const slot = node('li', ''); + if (item) { + slot.title = item.name; + slot.setAttribute('aria-label', item.name); + const source = items.get(item.id); + if (source && item.id !== selected.output.id) { + const anchor = link(source, ''); + anchor.setAttribute('aria-label', item.name); anchor.append(icon(item)); slot.append(anchor); + } else slot.append(icon(item)); + } + else slot.setAttribute('aria-label', 'Empty slot'); + return slot; + })); + + if (cooking) { + const heat = node('li', ''); + heat.className = 'recipe-heat'; + heat.setAttribute('aria-hidden', 'true'); + const fuel = node('li', ''); + fuel.title = 'Add any valid fuel'; + fuel.setAttribute('aria-label', 'Fuel slot'); + get('recipe-grid').append(heat, fuel); + } + + const directions = crafting + ? selected.shaped ? 'Arrange the ingredients exactly as shown.' : 'Place one ingredient in each occupied slot. The arrangement can vary.' + : selected.station === 'Brewing stand' ? 'Add the vial or potion below, place the spice above, and fuel the stand with blaze powder.' + : 'Place the ingredient in the input slot and supply fuel.'; + get('recipe-directions').textContent = [directions, selected.notes].filter(Boolean).join(' '); + get('recipe-variants').replaceChildren(...recipes.filter(entry => entry.output.id === selected.output.id && entry.id !== selected.id).map(variant => { + const row = node('li', ''); + row.append(link(variant, variant.station + ' · ' + variant.inputs.map(item => item.name).join(', '))); + return row; + })); + } + + const recipeId = () => new URLSearchParams(location.search).get('recipe'); + search.addEventListener('input', renderIndex); + get('main').addEventListener('click', event => { + const anchor = event.target.closest('a[href^="?recipe="]'); + if (!anchor || event.button || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; + event.preventDefault(); + history.pushState(null, '', anchor.href); + render(recipeId()); + get('recipe-name').focus({ preventScroll: true }); + }); + window.addEventListener('popstate', () => render(recipeId())); + render(recipeId()); + get('recipe-status').hidden = true; + get('recipe').hidden = false; +} catch { + get('recipe-status').textContent = 'The recipe catalogue could not be loaded. Refresh to try again.'; +} diff --git a/website/web/index.html b/website/web/index.html index ee000fa3..633d422f 100644 --- a/website/web/index.html +++ b/website/web/index.html @@ -5,10 +5,10 @@
MINECRAFT / JAVA + BEDROCKSupportSign inCreate account
DuneRealms · The Quest for Tavren II Aedrecht
- +
-
YOUR NEXT CHAPTER STARTS HERE

Your House.
Your destiny.

Explore worlds. Build alliances.
Write a story worth telling.

New player guide
Five worlds. One shared universe.
THE QUEST FOR TAVREN II AEDRECHT
+
YOUR NEXT CHAPTER STARTS HERE

Your House.
Your destiny.

Explore worlds. Build alliances.
Write a story worth telling.

Let’s Play Manual
Five worlds. One shared universe.
THE QUEST FOR TAVREN II AEDRECHT