Open the shared decision list from player and organisation menus

This commit is contained in:
unimatrixgit 2026-11-28 01:51:57 +01:00
commit e56f3e7392

View file

@ -57,10 +57,28 @@ final class QuestMenus implements Listener {
private void smugglerMenu(Player p,JsonObject data,PolQuestNpc.Role role){var input=new JsonObject();input.addProperty("action","smuggler_quote");smugglerRequest(p,input,quote->{var screen=panel(p,"NPC turn-in · "+role.name());screen.description="A personal smuggler passage is distinct from sanctioned Guild travel. Unsanctioned arrival may carry the existing in-game bounty.";roleAvatar(screen,data,role);if(!yes(quote,"eligible")){put(screen,13,"Ordinary Guild passage","Your current lawful route is available. Use the normal Guild Navigator.",Material.COMPASS,null);}else if(!yes(quote,"allowed")){put(screen,13,"Personal passage","Opt in with Esmar if ordinary Arrakis passage is unavailable. One hour from the verified introduction.",Material.COMPASS,null);put(screen,31,"Opt in to smuggling","Register the existing smuggler introduction and personal permission.",Material.LIME_DYE,()->{var introduction=data.getAsJsonArray("quests").asList().stream().map(JsonElement::getAsJsonObject).filter(q->text(q,"id","").equals("POL-SMUGGLERS-01")).findFirst().orElse(null);if(introduction==null){p.sendMessage("The current smuggler mission is unavailable.");return;}Runnable emit=()->{try{bridge.smugglerIntroduction(p);p.sendMessage("Introduction recorded. Reopen personal passage after J.A.R.V.I.S. verifies it.");}catch(Exception error){p.sendMessage("Meet Esmar Tuek in the Guild lobby.");}};if(yes(introduction,"canStart")&&!Set.of("active","completed","claimed").contains(text(introduction,"state",""))){var start=new JsonObject();start.addProperty("action","start");start.addProperty("kind","pol");start.addProperty("definitionId","POL-SMUGGLERS-01");start.addProperty("requestId",UUID.randomUUID().toString());start.addProperty("confirmed",true);request(p,start,ignored->emit.run());}else emit.run();});}else{long expiry=quote.get("permitExpiresAt").getAsLong();int price=quote.get("fareMinor").getAsInt();put(screen,13,"Personal passage to Arrakis","Fare: "+String.format(Locale.ROOT,"%.2f DM",price/100.0)+"\nPermission expires: "+java.time.Instant.ofEpochMilli(expiry)+"\nExisting unsanctioned-arrival rules apply.",Material.COMPASS,null);if(yes(quote,"affordable"))put(screen,31,"Book passage","Reserve this exact fare; payment settles only after arrival.",Material.LIME_DYE,()->{var board=new JsonObject();board.addProperty("action","smuggler_board");board.addProperty("requestId",UUID.randomUUID().toString());board.add("keyId",quote.get("keyId"));board.add("version",quote.get("version"));board.add("fareMinor",quote.get("fareMinor"));board.addProperty("destination","arrakis");smugglerRequest(p,board,ticket->{try{bridge.dispatchGuild(p,ticket);}catch(Exception error){p.sendMessage("The transfer was not dispatched; unused reservation expires.");}});});else put(screen,31,"Insufficient funds","Your personal central bank account must cover the fare.",Material.CLOCK,null);}put(screen,33,"Starter spice shovel","Open the existing starter objective for your original shovel; no duplicate issue.",Material.WOODEN_SHOVEL,()->{p.closeInventory();p.performCommand("start");});put(screen,49,"Back","Return to Esmar's missions",Material.ARROW,()->load(p,"pol",null,null,0));show(p,screen);});}
void decisionCommand(Player player,String[] args){
if(args.length==0){openDecisions(player,0);return;}
if(args.length!=1||!args[0].equalsIgnoreCase("list")){player.sendMessage("Use /decisions [list].");return;}
if(args.length!=1||!args[0].matches("[A-Za-z0-9-]{1,32}")){player.sendMessage("Use /decisions [list|decision-id].");return;}
String requested=args[0].toUpperCase(Locale.ROOT);
var input=new JsonObject();input.addProperty("action","read");
request(player,input,data->{
var decisions=data.getAsJsonArray("decisions");
if(!requested.equals("LIST")){
for(var value:decisions){
var decision=value.getAsJsonObject();
if(!requested.equals(text(decision,"id","")))continue;
player.sendMessage(text(decision,"title","Decision")+" · "+requested);
String description=dialogue(decision,"introduction","");
if(!description.isBlank())player.sendMessage(description);
String fee=text(decision,"feeMinor","");
if(fee.matches("[0-9]+"))player.sendMessage("Base cost: "+new java.math.BigDecimal(fee).movePointLeft(2).toPlainString()+" DM");
var contact=PolQuestNpc.decisionContact(text(decision,"npcRole",""));
if(text(decision,"kind","").equals("website"))decisionWebsite(player,requested);
else if(contact!=null)player.sendMessage("Contact: "+contact.name());
return;
}
player.sendMessage("That decision is not currently available to you.");
return;
}
if(decisions.isEmpty()){player.sendMessage("No political decisions are currently available to you.");return;}
for(var value:decisions){
var decision=value.getAsJsonObject();