From fbc7c2bfd5eb644cbfc6a1871e5b177af55d3875 Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Sun, 29 Nov 2026 11:20:30 +0100 Subject: [PATCH] Keep listing prices visible and focus long item details without purchase side effects --- DuneMenus/docs/MENU-POLISH-AND-EXCHANGE-PARITY.md | 4 ++-- .../java/com/dunerealms/menus/CanvasProvider.java | 7 ++++--- .../java/com/dunerealms/menus/SuppliedDocument.java | 13 ++++++++----- .../com/dunerealms/menus/RendererVerification.java | 9 +++++---- .../com/dunerealms/menus/SuppliedDocumentTest.java | 8 +++++++- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/DuneMenus/docs/MENU-POLISH-AND-EXCHANGE-PARITY.md b/DuneMenus/docs/MENU-POLISH-AND-EXCHANGE-PARITY.md index efc8917c..73e518d1 100644 --- a/DuneMenus/docs/MENU-POLISH-AND-EXCHANGE-PARITY.md +++ b/DuneMenus/docs/MENU-POLISH-AND-EXCHANGE-PARITY.md @@ -4,7 +4,7 @@ Objective: preserve the accepted fast full-screen menu design while containing t ## Scope -- DuneMenus 2.0.2: bounded compact summaries and titles; full original long lore remains below the grid, without adding a confirmation action. Private-use inventory glyphs and legacy formatting codes are removed from display text. House-adviser wording avoids assigning every adviser the Mentat profession. Council actions use a balanced grid; the Your House arrow is an ordinary action rather than a paging control. +- DuneMenus 2.0.2: bounded compact summaries and titles; price/stock/seller stay visible in summaries and an optional Details control opens one selected full-lore panel above the grid without executing the purchase, without adding a confirmation action. Private-use inventory glyphs and legacy formatting codes are removed from display text. House-adviser wording avoids assigning every adviser the Mentat profession. Council actions use a balanced grid; the Your House arrow is an ordinary action rather than a paging control. - Local illustrated website logo, proportionally contained in the header. Canonical PNG SHA256 267fe0d0b5adb4f2fb657d1d6827d030e7f837c94335d0a3643210b908f47931. Menu item icons resolve the actual ItemStack item_model to an existing central-pack flat texture. No quality/mark is inferred from a name. Unsupported dynamic/complex models retain a semantic fallback; this is not a general 3D item renderer. - Artwork is packaged from committed central inputs and unpacked at plugin startup. Model/image lookups are cached. There are no remote artwork requests on menu opening. - GUI 1.1.36 routes /exchange, namespaced aliases and /drgui exchange to the existing native ExchangeMenus.open path before the supplied-command interceptor. That is the same service used by the working GUI button and remains displayed by the fast ServiceMenu renderer. @@ -13,7 +13,7 @@ No economy, bank, purchase reference, retry, payment, delivery, JARVIS, Core, Es ## Verification and release -Local DuneMenus and GUI tests pass. Pinned real MCGUI 0.8.6 renderer checks fifteen menu families and 152 original action hitboxes; text-bound checks include long titles/descriptions and full scroll pages. A separate actual-image fixture renders the central legendary axe texture with the illustrated logo and cleaned lore. These are offline fixtures, not real purchase or connected-client acceptance. +Local DuneMenus and GUI tests pass. Pinned real MCGUI 0.8.6 renderer checks fifteen menu families and 152 original action hitboxes, including 28 long Exchange listings; text-bound checks include long titles/descriptions and full scroll pages. A separate actual-image fixture renders the central legendary axe texture with the illustrated logo and cleaned lore. These are offline fixtures, not real purchase or connected-client acceptance. Canonical exact-head CI, manifest review and guarded frontend-only canary are still required. Select only DuneMenus and DunerealmsGUI incoming JARs; retain all working backend binaries and current resource-pack pin. Verify actual command/GUI parity and representative custom item icons in-game, without speculative payment tests. diff --git a/DuneMenus/src/main/java/com/dunerealms/menus/CanvasProvider.java b/DuneMenus/src/main/java/com/dunerealms/menus/CanvasProvider.java index ccfa7b57..fdc93cb4 100644 --- a/DuneMenus/src/main/java/com/dunerealms/menus/CanvasProvider.java +++ b/DuneMenus/src/main/java/com/dunerealms/menus/CanvasProvider.java @@ -7,13 +7,14 @@ final class CanvasProvider implements FullscreenProvider { private final DuneMenusPlugin plugin; private final MenuArt art;private boolean prepared; CanvasProvider(DuneMenusPlugin plugin){this.plugin=plugin;this.art=new MenuArt(plugin);var services=plugin.getServer().getPluginManager().getPlugin("DunerealmsGUI");if(services!=null)try{art.prepare(services.getDataFolder().toPath().resolve("mcgui"));prepared=true;}catch(Exception failure){plugin.getLogger().warning("Menu artwork preparation failed: "+failure.getClass().getSimpleName());}} - public boolean open(Player player,Screen screen,IntConsumer select,Runnable close){ + public boolean open(Player player,Screen screen,IntConsumer select,Runnable close){return open(player,screen,select,close,-1);} + private boolean open(Player player,Screen screen,IntConsumer select,Runnable close,int selected){ var services=plugin.getServer().getPluginManager().getPlugin("DunerealmsGUI"); if(services==null||!services.isEnabled())return false; Map images=new HashMap<>(); try{if(prepared)for(Card card:screen.cards()){var inventory=screen.contents();if(card.slot()>=0&&card.slot() actions=new HashMap<>();for(Card card:screen.cards())actions.put(card.slot(),()->select.accept(card.slot())); - try{return Boolean.TRUE.equals(services.getClass().getMethod("presentSuppliedMenu",Player.class,String.class,String.class,Map.class,Runnable.class).invoke(services,player,screen.title(),SuppliedDocument.html(screen.id(),screen.title(),screen.subtitle(),screen.cards(),screen.info(),images),actions,close));} + Map actions=new HashMap<>();for(Card card:screen.cards()){actions.put(card.slot(),()->select.accept(card.slot()));if(SuppliedDocument.summary(card).size()>1)actions.put(1000+card.slot(),()->open(player,screen,select,close,card.slot()));} + try{return Boolean.TRUE.equals(services.getClass().getMethod("presentSuppliedMenu",Player.class,String.class,String.class,Map.class,Runnable.class).invoke(services,player,screen.title(),SuppliedDocument.html(screen.id(),screen.title(),screen.subtitle(),screen.cards(),screen.info(),images,selected),actions,close));} catch(ReflectiveOperationException failure){plugin.getLogger().warning("Menu canvas unavailable: "+failure.getClass().getSimpleName());return false;} } } diff --git a/DuneMenus/src/main/java/com/dunerealms/menus/SuppliedDocument.java b/DuneMenus/src/main/java/com/dunerealms/menus/SuppliedDocument.java index 6ea98bfa..6812705d 100644 --- a/DuneMenus/src/main/java/com/dunerealms/menus/SuppliedDocument.java +++ b/DuneMenus/src/main/java/com/dunerealms/menus/SuppliedDocument.java @@ -7,20 +7,23 @@ final class SuppliedDocument { static String accent(String id){return switch(id){case "travel"->"#7fd6e8";case "clan"->"#4fbf8a";case "company"->"#5cc8d6";case "spice"->"#e07b2e";case "war"->"#d2584a";case "politics"->"#b07ce8";case "missions"->"#9fc27a";case "equipment"->"#7fb2d9";default->"#d4ad5a";};} static String symbol(Card c){return switch(c.material()){case "compass"->"✥";case "emerald"->"◆";case "anvil"->"⚒";case "writable_book","book"->"▤";case "white_banner","green_banner"->"⚑";case "gold_block","gold_ingot"->"◈";case "blaze_powder"->"✦";case "lectern"->"♜";case "player_head"->"♟";case "nether_star"->"✷";case "arrow"->"←";case "barrier"->"×";default->"◇";};} static List lines(String text,int width){List out=new ArrayList<>();String rest=clean(text);while(rest.length()>width){int split=rest.lastIndexOf(' ',width);if(split summary(Card card){List out=new ArrayList<>();for(String line:card.lore())out.addAll(lines(line,30));return out;} + static List summary(Card card){List ordered=new ArrayList<>();for(String pattern:List.of("(?i).*\\bDM\\b.*","(?i).*(available|in stock).*","(?i).*seller:.*"))for(String line:card.lore())if(clean(line).matches(pattern)&&!ordered.contains(line))ordered.add(line);for(String line:card.lore())if(!ordered.contains(line))ordered.add(line);List out=new ArrayList<>();for(String line:ordered)out.addAll(lines(line,30));return out;} static String image(Card c,Map images){String image=images.getOrDefault(c.slot(),"");return image.matches("pack/assets/[a-z0-9_/.-]+\\.png")&&!image.contains("..")?"":symbol(c);} static String kind(Card c){if(!c.material().equals("arrow"))return "card";String t=clean(c.title()).toLowerCase(Locale.ROOT);return t.contains("back")?"back":t.contains("previous")||t.contains("next")?"pager":"card";} static String html(String id,String title,String subtitle,List cards,List info){return html(id,title,subtitle,cards,info,Map.of());} - static String html(String id,String title,String subtitle,List cards,List info,Map images){ + static String html(String id,String title,String subtitle,List cards,List info,Map images){return html(id,title,subtitle,cards,info,images,-1);} + static String html(String id,String title,String subtitle,List cards,List info,Map images,int selected){ String layout=switch(id){case "travel"->"constellation";case "clan","company","house","politics"->"council";case "missions","war"->"journal";case "bank","atm","withdraw","transfer"->"bank";default->"doors";}; StringBuilder b=new StringBuilder("
THE IMPERIAL CONCOURSE

").append(escape(title)).append("

").append(escape(subtitle)).append("

"); if(layout.equals("constellation"))b.append("
✷SPACING GUILD
"); + Card focused=cards.stream().filter(c->c.slot()==selected).findFirst().orElse(null); + if(focused!=null){b.append("

").append(escape(focused.title())).append("

");for(String line:focused.lore())b.append("

").append(escape(line)).append("

");b.append("
");} b.append("
");int index=0; int summaryLimit=layout.equals("constellation")?1:3; - for(Card c:cards){b.append("");} - b.append("
");for(Card c:cards)if(summary(c).size()>summaryLimit){b.append("

").append(escape(c.title())).append("

");for(String line:c.lore())b.append("

").append(escape(line)).append("

");b.append("
");}for(String line:info)b.append("

").append(escape(line)).append("

");return b.append("
◆ J.A.R.V.I.S. ◆
").toString(); + for(Card c:cards){b.append("");} + b.append("
");for(String line:info)b.append("

").append(escape(line)).append("

");return b.append("
◆ J.A.R.V.I.S. ◆
").toString(); } private static final String CSS=""" - *{box-sizing:border-box}body{margin:0;padding:12px;background:#03100f;color:#f1e7cd;font-family:Georgia,serif;font-size:13px}button{font-family:Georgia,serif;color:#f4df9d;cursor:pointer}.frame{min-height:570px;border:2px solid #b69149;outline:1px solid #645334;outline-offset:5px;background:#081e1b;position:relative;overflow:hidden}header{height:78px;border-bottom:2px solid #ae8943;background:linear-gradient(90deg,#102f29,#041512);display:flex;align-items:center;padding:8px 22px;gap:22px}.brand{display:flex;align-items:center;gap:8px;color:#d6ad58;font-size:38px;border-right:1px solid #7c683b;padding-right:20px}.brand span{font-size:16px;line-height:17px;letter-spacing:3px}.heading{flex:1}small{font-size:10px;letter-spacing:3px;color:#ad985f}h1{font-size:26px;margin:5px 0 0;color:#eed995;letter-spacing:1px}.close{width:31px;height:31px;border:1px solid #a58b4d;background:#112922;font-size:24px}.scene{position:relative;min-height:411px;padding:0 28px;overflow:hidden;background:linear-gradient(#162d30,#53665a 58%,#a88c52)}.quote{text-align:center;font-style:italic;position:relative;z-index:1;padding:12px 0 8px;margin:0;color:#f4e7bf}.dune{position:absolute;left:-12%;width:125%;height:180px;border-radius:55% 70% 0 0;pointer-events:none}.rear{bottom:0;background:#b4955a;transform:rotate(-8deg)}.front{bottom:-90px;background:#635a38;transform:rotate(9deg)}.moon{position:absolute;right:15%;top:23px;background:#e4dbb6;border-radius:50%;width:45px;height:45px;opacity:.55}main{position:relative;z-index:2}.doors,.bank{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:flex-start;padding:12px 0 35px}.card{background:linear-gradient(135deg,#173e35,#0c201d);border:1px solid #b59349;box-shadow:inset 0 0 0 3px #0a231f,0 3px 8px #071713;padding:12px;height:174px;display:block;text-align:left;width:22.5%;overflow:hidden}.card>div{width:100%;min-width:0}.card .emblem{display:block;float:left;width:44px;height:44px;margin:0 10px 6px 0}.item-icon{width:44px;height:44px;object-fit:contain;image-rendering:pixelated}.brand-logo{width:158px;height:58px;object-fit:contain}.brand{width:180px;flex-shrink:0}.card h2{line-height:1.2}.card p{line-height:1.25;white-space:normal;overflow-wrap:break-word}.item-details{border:1px solid #786338;background:#102a24;margin-top:12px;padding:16px}.item-details p{overflow-wrap:break-word}.card h2{overflow-wrap:break-word;white-space:normal}.card:hover{background:linear-gradient(135deg,#315c45,#183c32);border-color:#f3d784}.emblem{font-size:34px;color:var(--accent);width:35px;flex-shrink:0;text-align:center}h2{font-size:16px;margin:0 0 6px}p{margin:3px 0;font-size:11px;line-height:1.35;color:#d1d3bc}.back{position:absolute;bottom:2px;left:0;background:#12372c;border:1px solid #ad8c48;padding:7px 12px;display:flex;align-items:center;gap:8px}.pager{border:1px solid #ad8c48;background:#12372c;padding:10px;display:flex;gap:8px;align-items:center}.back .emblem{font-size:17px;width:auto}.back h2{margin:0;font-size:12px}.back p{display:none}.hub .card{width:22%;min-height:89px}.hub .emblem{font-size:30px}.journal{display:flex;flex-direction:column;gap:8px;padding:8px 9% 45px}.journal .card{width:100%;height:auto;min-height:68px;padding:8px 18px}.journal .card p{display:inline;margin-right:12px}.council{display:flex;flex-wrap:wrap;gap:16px;justify-content:center;padding:20px 8% 44px}.council .card{width:46%;height:174px;min-height:115px;border-top:3px solid var(--accent)}.bank .card{width:30%;min-height:100px}.travel .scene{background:radial-gradient(ellipse at center,#123a40,#061317)}.travel .dune,.travel .moon{display:none}.constellation{height:350px;position:relative}.constellation .card{position:absolute;width:230px;height:90px;min-height:83px;border-color:#74aeb6;background:linear-gradient(135deg,#173e43,#091c23)}.constellation .card .emblem{display:none}.constellation .n0{top:0;left:36%}.constellation .n1{top:98px;left:0}.constellation .n2{top:98px;right:0}.constellation .n3{top:225px;left:12%}.constellation .n4{top:225px;right:12%}.constellation .back{bottom:0}.guild{position:absolute;top:168px;left:44%;font-size:52px;color:#c4dcdf;text-align:center}.guild span{display:block;font-size:11px;letter-spacing:2px}.orbit{position:absolute;border:1px solid #467b84;width:62%;height:170px;top:130px;left:19%;border-radius:50%;transform:rotate(24deg)}.orbit.two{transform:rotate(-24deg)}footer{height:76px;padding:9px 22px;background:#0b211c;border-top:1px solid #a88b47;display:flex;align-items:center;gap:22px}.facts{position:relative;padding:12px 0 24px;z-index:2}.facts p{font-size:11px;color:#c0c9b2}.seal{font-size:10px;letter-spacing:2px;color:#bda464}.war .scene{background:linear-gradient(#2e2424,#182c26)}.spice .scene{background:linear-gradient(#715232,#bc9251)}.politics .scene{background:linear-gradient(#2f2444,#132c27)} + *{box-sizing:border-box}body{margin:0;padding:12px;background:#03100f;color:#f1e7cd;font-family:Georgia,serif;font-size:13px}button{font-family:Georgia,serif;color:#f4df9d;cursor:pointer}.frame{min-height:570px;border:2px solid #b69149;outline:1px solid #645334;outline-offset:5px;background:#081e1b;position:relative;overflow:hidden}header{height:78px;border-bottom:2px solid #ae8943;background:linear-gradient(90deg,#102f29,#041512);display:flex;align-items:center;padding:8px 22px;gap:22px}.brand{display:flex;align-items:center;gap:8px;color:#d6ad58;font-size:38px;border-right:1px solid #7c683b;padding-right:20px}.brand span{font-size:16px;line-height:17px;letter-spacing:3px}.heading{flex:1}small{font-size:10px;letter-spacing:3px;color:#ad985f}h1{font-size:26px;margin:5px 0 0;color:#eed995;letter-spacing:1px}.close{width:31px;height:31px;border:1px solid #a58b4d;background:#112922;font-size:24px}.scene{position:relative;min-height:411px;padding:0 28px;overflow:hidden;background:linear-gradient(#162d30,#53665a 58%,#a88c52)}.quote{text-align:center;font-style:italic;position:relative;z-index:1;padding:12px 0 8px;margin:0;color:#f4e7bf}.dune{position:absolute;left:-12%;width:125%;height:180px;border-radius:55% 70% 0 0;pointer-events:none}.rear{bottom:0;background:#b4955a;transform:rotate(-8deg)}.front{bottom:-90px;background:#635a38;transform:rotate(9deg)}.moon{position:absolute;right:15%;top:23px;background:#e4dbb6;border-radius:50%;width:45px;height:45px;opacity:.55}main{position:relative;z-index:2}.doors,.bank{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:flex-start;padding:12px 0 35px}.card{background:linear-gradient(135deg,#173e35,#0c201d);border:1px solid #b59349;box-shadow:inset 0 0 0 3px #0a231f,0 3px 8px #071713;padding:12px;height:174px;position:relative;display:block;text-align:left;width:22.5%;overflow:hidden}.card>div{width:100%;min-width:0}.card .emblem{display:block;float:left;width:44px;height:44px;margin:0 10px 6px 0}.detail-link{position:absolute;right:10px;top:10px;font-size:10px;padding:4px 6px;border:1px solid #8b784c;background:#163a30;color:#e4cd91}.detail-link:hover{background:#315c45}.item-icon{width:44px;height:44px;object-fit:contain;image-rendering:pixelated}.brand-logo{width:158px;height:58px;object-fit:contain}.brand{width:180px;flex-shrink:0}.card h2{line-height:1.2}.card p{line-height:1.25;white-space:normal;overflow-wrap:break-word}.item-details{border:1px solid #786338;background:#102a24;margin-top:12px;padding:16px}.item-details p{overflow-wrap:break-word}.card h2{overflow-wrap:break-word;white-space:normal}.card:hover{background:linear-gradient(135deg,#315c45,#183c32);border-color:#f3d784}.emblem{font-size:34px;color:var(--accent);width:35px;flex-shrink:0;text-align:center}h2{font-size:16px;margin:0 0 6px}p{margin:3px 0;font-size:11px;line-height:1.35;color:#d1d3bc}.back{position:absolute;bottom:2px;left:0;background:#12372c;border:1px solid #ad8c48;padding:7px 12px;display:flex;align-items:center;gap:8px}.pager{border:1px solid #ad8c48;background:#12372c;padding:10px;display:flex;gap:8px;align-items:center}.back .emblem{font-size:17px;width:auto}.back h2{margin:0;font-size:12px}.back p{display:none}.hub .card{width:22%;min-height:89px}.hub .emblem{font-size:30px}.journal{display:flex;flex-direction:column;gap:8px;padding:8px 9% 45px}.journal .card{width:100%;height:auto;min-height:68px;padding:8px 18px}.journal .card p{display:inline;margin-right:12px}.council{display:flex;flex-wrap:wrap;gap:16px;justify-content:center;padding:20px 8% 44px}.council .card{width:46%;height:174px;min-height:115px;border-top:3px solid var(--accent)}.bank .card{width:30%;min-height:100px}.travel .scene{background:radial-gradient(ellipse at center,#123a40,#061317)}.travel .dune,.travel .moon{display:none}.constellation{height:350px;position:relative}.constellation .card{position:absolute;width:230px;height:90px;min-height:83px;border-color:#74aeb6;background:linear-gradient(135deg,#173e43,#091c23)}.constellation .card .emblem{display:none}.constellation .n0{top:0;left:36%}.constellation .n1{top:98px;left:0}.constellation .n2{top:98px;right:0}.constellation .n3{top:225px;left:12%}.constellation .n4{top:225px;right:12%}.constellation .back{bottom:0}.guild{position:absolute;top:168px;left:44%;font-size:52px;color:#c4dcdf;text-align:center}.guild span{display:block;font-size:11px;letter-spacing:2px}.orbit{position:absolute;border:1px solid #467b84;width:62%;height:170px;top:130px;left:19%;border-radius:50%;transform:rotate(24deg)}.orbit.two{transform:rotate(-24deg)}footer{height:76px;padding:9px 22px;background:#0b211c;border-top:1px solid #a88b47;display:flex;align-items:center;gap:22px}.facts{position:relative;padding:12px 0 24px;z-index:2}.facts p{font-size:11px;color:#c0c9b2}.seal{font-size:10px;letter-spacing:2px;color:#bda464}.war .scene{background:linear-gradient(#2e2424,#182c26)}.spice .scene{background:linear-gradient(#715232,#bc9251)}.politics .scene{background:linear-gradient(#2f2444,#132c27)} """; } diff --git a/DuneMenus/src/rendererTest/java/com/dunerealms/menus/RendererVerification.java b/DuneMenus/src/rendererTest/java/com/dunerealms/menus/RendererVerification.java index 4fcaf9ce..8bd0a594 100644 --- a/DuneMenus/src/rendererTest/java/com/dunerealms/menus/RendererVerification.java +++ b/DuneMenus/src/rendererTest/java/com/dunerealms/menus/RendererVerification.java @@ -5,8 +5,8 @@ public class RendererVerification { Path dir=Path.of(args[0]);Files.createDirectories(dir);var loader=new Page.Loader(false,dir.resolve("engine-cache"));int checked=0; Files.createDirectories(dir.resolve("art"));Files.copy(Path.of("src/main/resources/menu-art/art/logo.png"),dir.resolve("art/logo.png"),StandardCopyOption.REPLACE_EXISTING); for(String id:List.of("hub","travel","exchange","clan","company","missions","spice","war","politics","house","equipment","bank","atm","withdraw","transfer")){ - List cards=new ArrayList<>();int count=id.equals("exchange")?28:id.equals("travel")?5:8; - for(int n=0;n cards=new ArrayList<>();int count=id.equals("exchange")?28:id.equals("travel")?5:8; + for(int n=0;n",html.indexOf("data-slot='13'"))); assertFalse(button.contains("Mending I"));assertTrue(html.contains("class='item-details'"));assertTrue(html.contains("Mending I"));assertTrue(html.contains("data-slot='13'")); } @@ -48,4 +48,10 @@ class SuppliedDocumentTest { var card=new Card(13,"Axe",List.of(),"netherite_axe");assertTrue(SuppliedDocument.image(card,java.util.Map.of(13,"pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png")).contains("x.contains("500 DM"))); + String html=SuppliedDocument.html("exchange","Buy","",List.of(first,second),List.of(),java.util.Map.of(),14); + assertEquals(1,html.split("class='item-details'",-1).length-1);assertTrue(html.contains("data-slot='1013'"));assertTrue(html.contains("data-slot='1014'"));assertTrue(html.contains("

Second

")); + } }