Complete authoritative balance adapter and collapse legacy hitbox aliases

This commit is contained in:
unimatrixgit 2026-11-29 02:40:55 +01:00
commit 794a96b5f8
5 changed files with 23 additions and 3 deletions

View file

@ -17,6 +17,6 @@
The new Java renderer consumes the ZIP menu definitions and direct slot callbacks; it does not use old MenuDocument selected-card pages. Existing native service models are wrapped without replacing their callback implementations. Shared NativeMenus inventory entry points (including DuneNPC travel) also enter the replacement. Estate services retain the original claim/Home Block/deployment screens; website-only organisation functions link to their existing management pages. No new confirmation intermediary is added.
Local verification: 140 Java sources compile for release21 against cached Paper1.21.8 dependencies; 12 focused tests pass. Four resource-pack tests pass and validate item-card fonts/textures in the actual ZIP. Browser render fixtures are local design evidence only. Full CI, actual MCGUI renderer comparison and live NPC/function checks remain required before declaring deployment complete.
Local verification: 140 Java sources compile for release21 against cached Paper1.21.8 dependencies; 14 focused tests pass. Four resource-pack tests pass and validate item-card fonts/textures in the actual ZIP. Browser render fixtures are local design evidence only. Full CI, actual MCGUI renderer comparison and live NPC/function checks remain required before declaring deployment complete.
Known visual work remains: the supplied preview's bespoke illustrations are reference artwork, while the dedicated canvas currently implements the gold/emerald frame, themed scenes, direct card grid, travel constellation and journal/council/bank layouts. Do not describe this as pixel-identical preview parity or a live install.

View file

@ -36,7 +36,7 @@ final class ExchangeMenu extends Menu {
back(46);
put(51, Ui.item(Material.CHEST, "<green>Collect purchases", "<gray>Move paid items to your inventory"),
t -> act(backend().collectPurchases(player)));
load(backend().balance(player), b -> put(47, Ui.item(Material.GOLD_INGOT, "<gold>Balance", "<white>" + Ui.dm(b))));
load(backend().balance(player), b -> put(47, Ui.item(Material.GOLD_INGOT, "<gold>Postbank available", "<white>" + Ui.dm(b))));
if (tab.equals("sell")) drawStall(); else drawShelf();
}

View file

@ -206,6 +206,13 @@ final class JarvisBackend implements Backend, Listener {
return value.matches("RIA-[A-F0-9]{32}")?value:"";
}
@Override public CompletableFuture<Long> balance(Player player) {
return bankAccount(player).thenApply(account -> {
if(account.postbankAvailableMinor()==null)throw new Unavailable();
return account.postbankAvailableMinor();
});
}
@Override public CompletableFuture<Account> bankAccount(Player player) {
UUID actor=player.getUniqueId();
return remote(player,()->{

View file

@ -23,10 +23,18 @@ final class ServiceMenu extends Menu {
this.title = title.replaceFirst("^NPC (dashboard|turn-in) · ", "");
this.subtitle = description.lines().findFirst().orElse("");
this.cards = inventory.getContents();
this.actions = Map.copyOf(actions);
this.actions = uniqueActions(actions);
for (int slot : actions.keySet()) if (!this.actions.containsKey(slot)) this.cards[slot] = null;
this.world = player.getWorld().getUID();
}
static Map<Integer,Runnable> uniqueActions(Map<Integer,Runnable> actions) {
var seen=java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<Runnable,Boolean>());
var result=new java.util.TreeMap<Integer,Runnable>();
new java.util.TreeMap<>(actions).forEach((slot,action)->{if(seen.add(action))result.put(slot,action);});
return Map.copyOf(result);
}
String id() { return section; }
Skin skin() {
return switch (section) {

View file

@ -17,6 +17,11 @@ class SuppliedDocumentTest {
assertTrue(html.contains("class='back n1' data-slot='46'"));
assertTrue(html.contains("class='pager n2' data-slot='53'"));
}
@Test void legacyHitboxAliasesBecomeOneCardWithoutDroppingDistinctActions(){
Runnable same=()->{};Runnable different=()->System.nanoTime();
var unique=ServiceMenu.uniqueActions(java.util.Map.of(18,same,19,same,20,same,22,different));
assertEquals(java.util.Set.of(18,22),unique.keySet());assertSame(same,unique.get(18));assertSame(different,unique.get(22));
}
@Test void eachPrimaryLayoutHasItsOwnPresentation(){
for(String id:List.of("hub","travel","exchange","clan","company","missions","spice","war","politics","house","equipment","bank","atm")){
String html=SuppliedDocument.html(id,id,"",List.of(),List.of());assertTrue(html.contains("frame "+id));assertTrue(html.contains(SuppliedDocument.accent(id)));