Keep listing prices visible and focus long item details without purchase side effects

This commit is contained in:
unimatrixgit 2026-11-29 11:20:30 +01:00
commit fbc7c2bfd5
5 changed files with 26 additions and 15 deletions

View file

@ -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.

View file

@ -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<Integer,String> images=new HashMap<>();
try{if(prepared)for(Card card:screen.cards()){var inventory=screen.contents();if(card.slot()>=0&&card.slot()<inventory.length){String image=art.image(inventory[card.slot()]);if(!image.isEmpty())images.put(card.slot(),image);}}}catch(Exception failure){plugin.getLogger().warning("Menu artwork unavailable: "+failure.getClass().getSimpleName());}
Map<Integer,Runnable> 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<Integer,Runnable> 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;}
}
}

File diff suppressed because one or more lines are too long

View file

@ -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<Card> cards=new ArrayList<>();int count=id.equals("exchange")?28:id.equals("travel")?5:8;
for(int n=0;n<count;n++)cards.add(new Card(n,(n==0?"Imperial Postbank · very long official account title":"Entry "+(n+1)),n==0?List.of("Personal level, Reputation and active quests","LEGENDARY | MK XIV","Efficiency VIII","Fortune IV","Mending I","Unbreaking IV","Amount: 100.00 DM"):List.of("Verified service detail","Amount: 100.00 DM"),id.equals("travel")?"compass":"emerald"));
long started=System.nanoTime();List<Card> cards=new ArrayList<>();int count=id.equals("exchange")?28:id.equals("travel")?5:8;
for(int n=0;n<count;n++)cards.add(new Card(n,(n==0?"Imperial Postbank · very long official account title":"Entry "+(n+1)),(n==0||id.equals("exchange"))?List.of("Personal level, Reputation and active quests","LEGENDARY | MK XIV","Efficiency VIII","Fortune IV","Mending I","Unbreaking IV","4 available · 100.00 DM each","Seller: Guild"):List.of("Verified service detail","Amount: 100.00 DM"),id.equals("travel")?"compass":"emerald"));
cards.add(new Card(45,"Back",List.of(),"arrow"));
String html=SuppliedDocument.html(id,"DuneRealms · "+id,"Service information",cards,List.of("Read-only account and permission details"));
Path file=dir.resolve(id+"-matrix.html");Files.writeString(file,html);var page=Page.of(html,file,loader);var frame=HtmlRenderer.render(page,1536,896,1.5,0,Selector.State.NONE);
@ -21,12 +21,13 @@ public class RendererVerification {
if(button==null||!button.attr("data-slot").equals(""+card.slot()))throw new AssertionError(id+" hit slot "+card.slot()+" at "+bounds+" scroll="+scroll+" got="+button);
checked++;
}
System.out.println(id+": parser clean; "+cards.size()+" action hitboxes; maxScroll="+frame.maxScroll());
System.out.println(id+": parser clean; "+cards.size()+" action hitboxes; maxScroll="+frame.maxScroll()+"; render-and-hitbox-ms="+((System.nanoTime()-started)/1_000_000));
}
var actualIcon=Path.of("../network/resource-pack/central/overlay/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png");Path iconTarget=dir.resolve("pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png");Files.createDirectories(iconTarget.getParent());Files.copy(actualIcon,iconTarget,StandardCopyOption.REPLACE_EXISTING);
var listing=new Card(13,"\uE400§6Paul's chopper",List.of("LEGENDARY | MK XIV","Used by Paul himself.","Efficiency VIII","Fortune IV","Mending I","Unbreaking IV","Seller: J.A.R.V.I.S. HQ","1 available · 500.00 DM each"),"netherite_axe");
String listingHtml=SuppliedDocument.html("exchange","Exchange · Buy","Authoritative item artwork",List.of(new Card(9,"Buy",List.of("Browse available items"),"emerald"),listing),List.of(),Map.of(13,"pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png"));
String listingHtml=SuppliedDocument.html("exchange","Exchange · Buy","Authoritative item artwork",List.of(new Card(9,"Buy",List.of("Browse available items"),"emerald"),listing),List.of(),Map.of(13,"pack/assets/dunerealms/textures/item/equipment/legendary_mk14_axe.png"),13);
var listingPage=Page.of(listingHtml,dir.resolve("exchange-item.html"),loader);var listingFrame=HtmlRenderer.render(listingPage,1536,896,1.5,0,Selector.State.NONE);if(!listingPage.problems.isEmpty())throw new AssertionError(listingPage.problems.toString());ImageIO.write(listingFrame.image(),"png",dir.resolve("exchange-item-engine.png").toFile());
for(var element:listingPage.document.select("[data-slot='1013']")){var bounds=listingFrame.boundsOf(element);var at=listingFrame.elementAt(bounds.getCenterX(),bounds.getCenterY());if(at==null||!at.closest("[data-slot]").attr("data-slot").equals("1013"))throw new AssertionError("Detail control hitbox");}
System.out.println("PASS: "+checked+" direct action hitboxes across15 menu families.");
}
}

View file

@ -35,7 +35,7 @@ class SuppliedDocumentTest {
}
@Test void longListingLoreIsBoundedInCardsAndRetainedInDetails(){
var lore=List.of("LEGENDARY | MK XIV","Used by Paul himself.","Efficiency VIII","Fortune IV","Mending I","Unbreaking IV","Seller: JARVIS HQ","1 available · 500 DM each");
String html=SuppliedDocument.html("exchange","Buy","",List.of(new Card(13,"Paul's chopper",lore,"netherite_axe")),List.of());
String html=SuppliedDocument.html("exchange","Buy","",List.of(new Card(13,"Paul's chopper",lore,"netherite_axe")),List.of(),java.util.Map.of(),13);
String button=html.substring(html.indexOf("data-slot='13'"),html.indexOf("</button>",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("<img"));
assertFalse(SuppliedDocument.image(card,java.util.Map.of(13,"https://evil/image.png")).contains("<img"));assertFalse(SuppliedDocument.image(card,java.util.Map.of(13,"pack/assets/../secret.png")).contains("<img"));
}
@Test void listingPriceAndStockStayVisibleAndOnlySelectedFullLoreIsRendered(){
var lore=List.of("LEGENDARY | MK XIV","Long flavour text","Efficiency VIII","Fortune IV","Mending I","Seller: Guild","4 available · 500 DM each");var first=new Card(13,"First",lore,"netherite_axe");var second=new Card(14,"Second",lore,"netherite_axe");
assertTrue(SuppliedDocument.summary(first).subList(0,3).stream().anyMatch(x->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("<div class='item-details'><h2>Second</h2>"));
}
}