Give Rihla focused ATM screens, native reference entry and receipts

This commit is contained in:
unimatrixgit 2026-11-29 13:22:40 +01:00
commit abfa82bca8

View file

@ -4,6 +4,22 @@ public class RendererVerification {
public static void main(String[]args)throws Exception{
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);
Files.copy(Path.of("src/main/resources/menu-art/art/rihla.png"),dir.resolve("art/rihla.png"),StandardCopyOption.REPLACE_EXISTING);
for(String operation:List.of("withdraw","deposit","redeem","receipt")){
List<Card> cash=new ArrayList<>();Map<Integer,String> cashArt=new HashMap<>();
if(operation.equals("withdraw")||operation.equals("deposit")){
String[] names={"note_10","note_20","note_50","note_100","note_500","coin_050","coin_1dm","coin_2dm"};String[] amounts={"10.00","20.00","50.00","100.00","500.00","0.50","1.00","2.00"};
for(int n=0;n<names.length;n++){cash.add(new Card(10+n,amounts[n]+" DM",List.of("Select one bill or coin"),"paper"));String asset="pack/assets/dunerealms/textures/item/currency/"+names[n]+".png";Path target=dir.resolve(asset);Files.createDirectories(target.getParent());Files.copy(Path.of("../network/resource-pack/central/overlay/assets/dunerealms/textures/item/currency/"+names[n]+".png"),target,StandardCopyOption.REPLACE_EXISTING);cashArt.put(10+n,asset);}
cash.add(new Card(24,operation.equals("withdraw")?"Withdraw 50.00 DM":"Deposit 50.00 DM",List.of(),"gold_ingot"));
}else if(operation.equals("redeem"))cash.add(new Card(13,"Enter RIA ID",List.of("Open the reference entry window"),"writable_book"));
cash.add(new Card(36,"Back",List.of(),"arrow"));
String html=SuppliedDocument.html(operation,"Rihla · "+operation,"Choose your transaction",cash,operation.equals("receipt")?List.of("Cash deposit — Amount: 50.00 DM","RIA ID — RIA-0123456789ABCDEF0123456789ABCDEF"):List.of(),cashArt);
var page=Page.of(html,dir.resolve("rihla-"+operation+".html"),loader);
var frame=HtmlRenderer.render(page,1536,896,1.5,0,Selector.State.NONE);
if(!page.problems.isEmpty())throw new AssertionError(page.problems.toString());
for(Card card:cash){var element=page.document.selectFirst("[data-slot='"+card.slot()+"']");var bounds=frame.boundsOf(element);if(bounds==null)throw new AssertionError("Missing Rihla action");var hit=frame.elementAt(bounds.getCenterX(),bounds.getCenterY());if(hit==null||hit.closest("[data-slot]")==null||!hit.closest("[data-slot]").attr("data-slot").equals(""+card.slot()))throw new AssertionError("Rihla action outside initial viewport "+operation+" "+card.slot());}
ImageIO.write(frame.image(),"png",dir.resolve("rihla-"+operation+"-engine.png").toFile());
}
for(String id:List.of("hub","travel","exchange","clan","company","missions","spice","war","politics","house","equipment","bank","atm","withdraw","transfer")){
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"));