Open a shared political Decisions screen from NPCs and the journal
This commit is contained in:
parent
13df172a7e
commit
897fc46489
7 changed files with 72 additions and 27 deletions
|
|
@ -107,6 +107,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
if(args.length!=1||!HOUSE_IDS.contains(id)){p.sendMessage("Use /house <"+String.join("|",IDS)+">");return true;}
|
||||
fetch(p,null,0,null,data->declareHouse(p,data,id,false));return true;
|
||||
}
|
||||
if(command.getName().equals("decisions")){quests.openDecisions(p,0);return true;}
|
||||
if(command.getName().equals("rosterkey")){if(args.length!=1)p.sendMessage("Use /rosterkey <team invite code>");else warMenus.accept(p,args[0]);return true;}
|
||||
if(command.getName().equals("warmuster")){warMenus.open(p);return true;}
|
||||
if(command.getName().equals("start")){quests.starterJournal(p);return true;}
|
||||
|
|
|
|||
|
|
@ -52,17 +52,31 @@ final class MenuDocument {
|
|||
static String roleplay(String title,String description,List<Card> cards,int selected,Path root){
|
||||
String[] parts=title.split(" · ",2);String mode=parts[0],name=parts.length==2?parts[1]:"Quest contact";boolean decision=mode.contains("decision"),dashboard=mode.startsWith("NPC dashboard"),next=mode.startsWith("NPC next quest");Card avatar=cards.stream().filter(c->c.material.matches("npc_avatar_[0-7]")).findFirst().orElse(null);String portrait=avatar==null?"":icon(avatar,root);if(portrait.isEmpty()&&Files.isRegularFile(root.resolve("art/npc_avatar_7.png")))portrait="art/npc_avatar_7.png";Card summary=cards.stream().filter(c->c.material.equals("npc_summary")).findFirst().orElse(null);Card world=cards.stream().filter(c->c.material.startsWith("npc_world_")).findFirst().orElse(null);Card pick=cards.stream().filter(c->dashboard&&c.action&&c.slot>=9&&c.slot<45&&c.slot==selected).findFirst().orElse(null);
|
||||
String heading=decision?(dashboard?"YOUR DECISIONS":next?"DECISION RECORDED":"REVIEW DECISION"):dashboard?"YOUR MISSIONS":next?"YOUR NEXT MISSION":cards.stream().anyMatch(c->c.title.equals("Claim verified reward")||c.title.equals("Next quest"))?"MISSION COMPLETE":"MISSION TURN-IN";
|
||||
StringBuilder b=new StringBuilder("<!doctype html><html><head><meta charset=\"utf-8\"><title>DuneRealms · Dialogue</title><style>").append(ROLEPLAY_CSS).append("</style></head><body><div class=\"frame\"><aside class=\"portrait\">");
|
||||
StringBuilder b=new StringBuilder("<!doctype html><html><head><meta charset=\"utf-8\"><title>DuneRealms · Dialogue</title><style>").append(ROLEPLAY_CSS).append(decision?DECISION_CSS:"").append("</style></head><body><div class=\"frame\"><aside class=\"portrait\">");
|
||||
if(!portrait.isEmpty())b.append("<img class=\"avatar\" src=\"").append(portrait).append("\">");b.append("<div class=\"nameplate\"><h2>").append(escape(avatar==null?name:avatar.title)).append("</h2>");if(avatar!=null)for(String line:avatar.lore)b.append("<p>").append(escape(line)).append("</p>");b.append("</div></aside><section class=\"content\"><header><span>━━</span><h1>").append(escape(heading)).append("</h1><span>━━</span></header>");
|
||||
if(summary!=null){b.append("<div class=\"summary\">");for(String line:summary.lore){if(line.matches("Progress: [0-9]{1,3}%")){int percent=Math.max(0,Math.min(100,Integer.parseInt(line.substring(10,line.length()-1))));b.append("<div class=\"bar\"><div style=\"width:").append(percent).append("%\"></div></div>");}else b.append("<p>").append(escape(line)).append("</p>");}b.append("</div>");}
|
||||
if(!description.isBlank())b.append("<p class=\"dialogue\">").append(escape(description)).append("</p>");else if(world!=null&&!dashboard){String art=icon(world,root);if(!art.isEmpty())b.append("<img class=\"dialogue-art\" src=\"").append(art).append("\">");}
|
||||
boolean paths=false;for(Card c:cards){if(c==avatar||c==summary||c==world)continue;if(dashboard&&c.action&&c.slot>=9&&c.slot<45){boolean available=c.lore.stream().anyMatch(l->l.equals("Eligible to accept"));if(available&&!paths){b.append("<h3 class=\"paths\">AVAILABLE PATHS</h3>");paths=true;}b.append("<button class=\"mission ").append(c==pick?"selected":"").append("\" data-pick=\"").append(c.slot).append("\"><strong>").append(escape(c.title)).append("</strong><span>").append(escape(c.lore.isEmpty()?"":c.lore.get(0))).append("</span></button>");continue;}
|
||||
boolean paths=false;for(Card c:cards){if(c==avatar||c==summary||c==world)continue;if(dashboard&&c.action&&c.slot>=9&&c.slot<45){boolean available=c.lore.stream().anyMatch(l->l.equals("Eligible to accept"));if(available&&!paths){b.append("<h3 class=\"paths\">AVAILABLE PATHS</h3>");paths=true;}b.append("<button class=\"mission ").append(c==pick?"selected":"").append(decision?"\" data-slot=\"":"\" data-pick=\"").append(c.slot).append("\"><strong>").append(escape(c.title)).append("</strong><span>").append(escape(c.lore.isEmpty()?"":c.lore.get(0))).append("</span></button>");continue;}
|
||||
if(c.action)continue;b.append("<article class=\"record\"><h3>").append(escape(c.title)).append("</h3>");for(String line:c.lore)b.append("<p>").append(escape(line)).append("</p>");b.append("</article>");}
|
||||
if(dashboard&&pick!=null)b.append("<button class=\"primary\" data-slot=\"").append(pick.slot).append("\">SELECT ").append(decision?"DECISION":"MISSION").append("</button>");
|
||||
if(dashboard&&pick==null&&cards.stream().anyMatch(c->c.action&&c.slot>=9&&c.slot<45))b.append("<p class=\"hint\">Select an entry to continue.</p>");
|
||||
if(dashboard&&!decision&&pick!=null)b.append("<button class=\"primary\" data-slot=\"").append(pick.slot).append("\">SELECT ").append(decision?"DECISION":"MISSION").append("</button>");
|
||||
if(dashboard&&!decision&&pick==null&&cards.stream().anyMatch(c->c.action&&c.slot>=9&&c.slot<45))b.append("<p class=\"hint\">Select an entry to continue.</p>");
|
||||
for(Card c:cards){if(!c.action||dashboard&&c.slot>=9&&c.slot<45)continue;String action=c.title.equals("Claim verified reward")?"CLAIM & CONTINUE":c.title;boolean primary=c.slot==31||c.title.equals("Accept")||c.title.equals("Confirm and execute");b.append("<button class=\"").append(primary?"primary":"secondary").append("\" data-slot=\"").append(c.slot).append("\">").append(escape(action)).append("</button>");}
|
||||
return b.append("</section><footer>SHIFT TO CLOSE</footer></div></body></html>").toString();
|
||||
}
|
||||
private static final String DECISION_CSS="""
|
||||
body{background:#182126}
|
||||
.frame{background:#253238;border:3px solid #b28d52;grid-template-columns:25% 75%;padding:24px}
|
||||
.portrait{background:#202a2f;border-right:1px solid #927449;padding:18px 18px 115px;min-height:535px}
|
||||
.nameplate{left:12px;right:12px}
|
||||
.content{padding:4px 22px 30px;text-align:left}
|
||||
header{border-bottom:2px solid #927449;margin-bottom:14px;padding:8px;background:#313b3b}
|
||||
.dialogue{text-align:left;margin:12px 0;color:#f4e6cd}
|
||||
.summary,.record{max-width:none;background:#202e37;border:1px solid #927449;margin:10px 0}
|
||||
.mission{width:100%;min-height:48px;margin:7px 0;padding:9px 15px;border:1px solid #6f8b9a;border-left:4px solid #c49b5b;border-radius:3px;background:linear-gradient(#354c5a,#293c49)}
|
||||
.mission span{color:#f1dab2}.mission:hover{background:#406072}
|
||||
.secondary{width:auto;display:inline-block;margin:8px 10px 0 0}
|
||||
footer{left:27%}
|
||||
""";
|
||||
private static final String ROLEPLAY_CSS="""
|
||||
*{box-sizing:border-box}body{margin:0;color:#f8edcf;background:#061c13;font-family:'Source Serif 4',Georgia,serif}.frame{position:relative;min-height:597px;width:100%;display:grid;grid-template-columns:30% 70%;background-image:url('art/quest-dialogue-frame.png');background-size:100% 100%;background-repeat:no-repeat;padding:18px 22px 42px}.portrait{position:relative;padding:17px 27px 122px 17px;display:flex;align-items:center;justify-content:center;min-height:500px}.avatar{width:100%;height:auto;max-height:370px;object-fit:contain;image-rendering:pixelated}.nameplate{position:absolute;bottom:10px;left:18px;right:36px;text-align:center}.nameplate h2{font-size:25px;line-height:1.08;margin:0;color:#f6e2a8}.nameplate p{font-style:italic;font-size:14px;color:#e5cb8f;margin:8px 4px}.content{padding:0 40px 30px 33px;min-width:0;text-align:center}header{display:flex;align-items:center;justify-content:center;gap:16px;color:#cfa94c}h1{margin:0 0 7px;color:#fff2cd;font-size:32px;letter-spacing:1px;line-height:1.1}.dialogue-art{width:80%;max-height:140px;object-fit:cover;border:1px solid #b59b58;margin:8px auto}.dialogue{font-size:17px;color:#f2dfb1;font-style:italic;margin:7px auto 12px;line-height:1.3;max-width:95%}.summary,.record{border:2px solid #bc9f52;border-radius:6px;padding:8px 14px;margin:9px auto;background:#05251bd9;max-width:96%}.bar{height:15px;border:1px solid #d9ba68;background:#09291d;margin:5px 20px}.bar div{height:100%;background:linear-gradient(#ffe17c,#c69a32)}.summary p,.record p{margin:4px 0;line-height:1.25;font-size:14px}.record h3{margin:2px 0 6px;font-size:20px;color:#f1d293}.paths{color:#f5e0a5;font-size:20px;letter-spacing:1px;margin:12px 0 6px}.mission,.primary,.secondary{background:linear-gradient(#113a29,#08281d);border:2px solid #c0a150;color:#f9ecc6;min-height:36px;padding:7px 15px;border-radius:7px;font:600 16px 'Source Serif 4',Georgia,serif;display:block;width:96%;margin:7px auto;box-shadow:inset 0 1px 0 #f5e0a450}.mission{text-align:left;display:flex;justify-content:space-between;gap:12px}.mission span{font-size:13px;color:#e8d09b}.mission.selected span{color:#3a2c0b}.mission.selected,.primary{background:linear-gradient(#ffe082,#c99a2d);color:#1b1a0b;border:2px solid #fff1b3;box-shadow:0 0 10px #e0ad4b66,inset 0 1px 0 #fff0b9}.primary{font-size:20px;font-weight:700;width:80%;text-transform:uppercase;min-height:43px}.secondary{width:72%;font-size:15px;min-height:33px}.mission:hover,.secondary:hover{border-color:#fff0b9}.hint{color:#cbb47d;font-style:italic;font-size:13px}footer{position:absolute;bottom:13px;left:32%;right:3%;text-align:center;font-size:13px;letter-spacing:3px;color:#f5dd98;font-weight:700}
|
||||
""";
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ final class PolQuestNpc implements Listener {
|
|||
private final JavaPlugin plugin;private final BiConsumer<Player,Role> open;private final File file;private final YamlConfiguration positions;
|
||||
private UUID imperialUuid;private String imperialName,imperialTerm;private long imperialRetry;
|
||||
PolQuestNpc(JavaPlugin plugin,BiConsumer<Player,Role> open){this.plugin=plugin;this.open=open;file=new File(plugin.getDataFolder(),"quest-npc-positions.yml");positions=YamlConfiguration.loadConfiguration(file);Bukkit.getPluginManager().registerEvents(this,plugin);Bukkit.getScheduler().runTaskLater(plugin,()->Bukkit.getWorlds().forEach(this::ensure),100);}
|
||||
static Role decisionContact(String id){return ROLES.stream().filter(r->r.key().equals(id)).findFirst().orElse(null);}
|
||||
private static Role role(String id,World world){return ROLES.stream().filter(r->r.key().equals(id)&&r.world().equals(world.getName())).findFirst().orElse(null);}
|
||||
private String base(Role role){return role.world()+"."+role.key();}
|
||||
private Location saved(Role role,World world){String b=base(role);return positions.contains(b+".x")?new Location(world,positions.getDouble(b+".x"),positions.getDouble(b+".y"),positions.getDouble(b+".z"),(float)positions.getDouble(b+".yaw"),(float)positions.getDouble(b+".pitch")):null;}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ final class QuestMenus implements Listener {
|
|||
}
|
||||
private void show(Player p,Panel screen){if(BedrockForms.isBedrock(p)){BedrockForms.show(plugin,p,screen.title,screen.description,List.copyOf(screen.choices));return;}if(MCGUIMenus.show(p,screen.title,screen.description,screen.inventory,screen.actions,screen.gate))return;p.openInventory(screen.inventory);Bukkit.getScheduler().runTaskLater(plugin,screen.gate::expire,2400L);}
|
||||
void close(){pending.clear();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Panel)p.closeInventory();}
|
||||
void open(Player p){roleScope.remove(p.getUniqueId());var screen=panel(p,"Mission journal");put(screen,20,"Personal Experience","Your personal mission branches",Material.BOOK,()->load(p,"personal",null,null,0));put(screen,24,"Reputation","Your Reputation mission branches",Material.ENCHANTED_BOOK,()->load(p,"pol",null,null,0));put(screen,45,"Website Mentat Report","Open your full online journal",Material.MAP,()->website(p));put(screen,49,"Back","Imperial Codex",Material.ARROW,()->back.accept(p));show(p,screen);}
|
||||
void open(Player p){roleScope.remove(p.getUniqueId());var screen=panel(p,"Mission journal");put(screen,20,"Personal Experience","Your personal mission branches",Material.BOOK,()->load(p,"personal",null,null,0));put(screen,24,"Reputation","Your Reputation mission branches",Material.ENCHANTED_BOOK,()->load(p,"pol",null,null,0));put(screen,31,"Political decisions","Decisions available to your current offices",Material.WRITABLE_BOOK,()->openDecisions(p,0));put(screen,45,"Website Mentat Report","Open your full online journal",Material.MAP,()->website(p));put(screen,49,"Back","Imperial Codex",Material.ARROW,()->back.accept(p));show(p,screen);}
|
||||
void starterJournal(Player p){roleScope.remove(p.getUniqueId());load(p,"personal","h",null,0);}
|
||||
void openRole(Player p,PolQuestNpc.Role role){roleScope.put(p.getUniqueId(),role);if(role.branches().contains("prologue")){housePrologue(p,role);return;}load(p,"pol",null,null,0);}
|
||||
private void housePrologue(Player p,PolQuestNpc.Role role){var input=new JsonObject();input.addProperty("action","read");input.addProperty("kind","personal");input.addProperty("npcRole",role.key());request(p,input,data->{var screen=panel(p,"NPC turn-in · "+role.name());roleAvatar(screen,data,role);var state=data.has("housePrologue")&&data.get("housePrologue").isJsonObject()?data.getAsJsonObject("housePrologue"):new JsonObject();screen.description=text(state,"dialogue","");if(!yes(state,"required")){put(screen,13,"Welcome back","Your established preparation is retained. Use the existing Guild Navigator for passage.",Material.COMPASS,null);}else if(!role.key().equals(text(state,"mentor",""))){put(screen,13,"Choose your House","Meet the adviser of your current House. Visit the existing account and House selection flow.",Material.BOOK,null);put(screen,31,"Open account and House selection","Complete your account and select a House before returning.",Material.MAP,()->{p.closeInventory();p.sendMessage(Component.text("Open your account and House selection →",NamedTextColor.GOLD).clickEvent(ClickEvent.openUrl("https://cp.dunerealms.com/")));});}else{put(screen,13,"House Prologue","Account setup: "+(yes(state,"onboarding")?"Verified":"Pending")+"\nProfile: "+(yes(state,"profile")?"Verified":"Pending")+"\nMentat introduction: "+(yes(state,"introduced")?"Verified":"Pending")+"\nStarter equipment: "+(yes(state,"kit")?"Verified":"Pending"),Material.WRITABLE_BOOK,null);if(!yes(state,"introduced"))put(screen,31,"Acknowledge House introduction","Record this matching Mentat interaction. Rewards are issued automatically on verification.",Material.LIME_DYE,()->{try{bridge.houseMentorIntroduction(p,role.key());p.sendMessage("Introduction recorded. Reopen this contact to refresh your verified progress.");}catch(Exception error){p.sendMessage("Return to your matching House Mentat.");}});else if(!yes(state,"kit"))put(screen,31,"Your starter equipment","Open the existing starter objective; retain your original shovel and kit.",Material.WOODEN_SHOVEL,()->{p.closeInventory();p.performCommand("start");});else if(yes(state,"ready"))put(screen,31,"Your first passage is unlocked","Use the existing Guild Navigator to travel to your native world.",Material.COMPASS,null);else put(screen,31,"Finish account preparation","Complete the existing website profile and first sign-in requirements.",Material.MAP,()->{p.closeInventory();p.sendMessage(Component.text("Open your account →",NamedTextColor.GOLD).clickEvent(ClickEvent.openUrl("https://cp.dunerealms.com/")));});}put(screen,49,"Refresh","Check your actual progress and automatically recorded rewards",Material.ARROW,()->housePrologue(p,role));show(p,screen);});}
|
||||
|
|
@ -51,21 +51,41 @@ final class QuestMenus implements Listener {
|
|||
int slot=9;for(var q:ordered){if(slot>=45)break;String status=Set.of("active","completed").contains(text(q,"state",""))?"Progress: "+text(q,"progress","0")+" / "+text(q,"target","1"):"Eligible to accept";put(screen,slot++,text(q,"title","Mission"),status+"\n"+text(q,"id","")+" · "+text(q,"objective",""),Material.WRITABLE_BOOK,()->roleSelected(p,data,role,q));}
|
||||
if(ordered.isEmpty())put(screen,13,"No eligible missions","Read the website journal for the full record.",Material.MAP,null);
|
||||
if(role.key().equals("esmar_tuek"))put(screen,47,role.world().equals("guild_lobby")?"Personal smuggler passage":"Smuggler return",role.world().equals("guild_lobby")?"Opt in with Esmar or board your paid one-hour personal route.":"Return to the Guild from your confirmed smuggler arrival.",Material.COMPASS,()->{if(role.world().equals("guild_lobby"))smugglerMenu(p,data,role);else try{bridge.returnSmuggler(p);}catch(Exception failure){p.sendMessage("Meet Esmar Tuek on Arrakis to return.");}});
|
||||
if(Set.of("thufir_hawat","piter_de_vries","hasimir_fenring","roma_atani","imperial_attendant","stilgar","jessica_atreides","gaius_helen_mohiam","alia_atreides","edric","guild_navigator","duncan_idaho").contains(role.key()))put(screen,48,"POL decisions","See only current executable political decisions",Material.BOOK,()->roleDecisionDashboard(p,data,role));put(screen,49,"Website journal","Full mission choices and history",Material.MAP,()->website(p));show(p,screen);
|
||||
if(Set.of("thufir_hawat","piter_de_vries","hasimir_fenring","roma_atani","imperial_attendant","stilgar","jessica_atreides","gaius_helen_mohiam","alia_atreides","edric","guild_navigator","duncan_idaho").contains(role.key()))put(screen,48,"POL decisions","See only current executable political decisions",Material.BOOK,()->openDecisions(p,0));put(screen,49,"Website journal","Full mission choices and history",Material.MAP,()->website(p));show(p,screen);
|
||||
}
|
||||
private void smugglerRequest(Player p,JsonObject input,Consumer<JsonObject> callback){try{bridge.questCharacterNpc(p,"esmar_tuek");}catch(Exception unavailable){p.sendMessage("Meet Esmar Tuek first.");return;}UUID id=p.getUniqueId(),world=p.getWorld().getUID(),operation=UUID.randomUUID();if(pending.putIfAbsent(id,operation)!=null)return;p.closeInventory();Bukkit.getScheduler().runTaskAsynchronously(plugin,()->{JsonObject result=null;String error=null;try{if(text(input,"action","").equals("smuggler_board")&&!bridge.worldOnline("arrakis"))throw new IllegalStateException("Arrakis is currently unavailable.");result=bridge.guild(id,input);}catch(Exception failure){error=failure.getMessage();}var response=result;String message=error;Bukkit.getScheduler().runTask(plugin,()->{if(!pending.remove(id,operation)||!p.isOnline()||!p.getWorld().getUID().equals(world))return;if(response==null){p.sendMessage(message==null?"The smuggler passage is unavailable.":message);return;}callback.accept(response);});});}
|
||||
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,"Confirm paid 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);});}
|
||||
private void roleDecisionDashboard(Player p,JsonObject contact,PolQuestNpc.Role role){var input=new JsonObject();input.addProperty("action","read");input.addProperty("npcRole",role.key());decisionRequest(p,role,input,data->{var screen=panel(p,"NPC dashboard decision · "+role.name());screen.description="Choose a decision you currently have the authority to execute.";roleAvatar(screen,contact,role);int slot=9;for(var e:data.getAsJsonArray("decisions")){var row=e.getAsJsonObject();if(slot>=45)break;put(screen,slot++,text(row,"title","Decision"),"Required Reputation: "+text(row,"level","—")+"\n"+(text(row,"kind","").equals("website")?"Continue through the verified website workflow.":(row.has("fundingRequired")&&!yes(row,"fundingRequired")?"Review the parameter and confirm.":"Review funding and confirm.")),Material.BOOK,()->roleDecisionDetails(p,contact,role,row,null,null));}if(slot==9)put(screen,13,"No executable decisions","Your current office, authority and cooldown determine what appears here.",Material.MAP,null);put(screen,48,"Back","Mission dashboard",Material.ARROW,()->load(p,"pol",null,null,0));put(screen,49,"Website","Full decision definitions and history",Material.MAP,()->decisionWebsite(p));show(p,screen);});}
|
||||
void openDecisions(Player p,int page){
|
||||
var input=new JsonObject();input.addProperty("action","read");
|
||||
request(p,input,data->{
|
||||
var screen=panel(p,"NPC dashboard decision · Political decisions");
|
||||
screen.description="Decisions available to your current political offices and mandates.";
|
||||
var decisions=data.getAsJsonArray("decisions");
|
||||
int pageSize=27,last=Math.max(0,(decisions.size()-1)/pageSize),current=Math.min(page,last),slot=9;
|
||||
for(int index=current*pageSize;index<Math.min(decisions.size(),(current+1)*pageSize);index++){
|
||||
var row=decisions.get(index).getAsJsonObject();
|
||||
var contact=PolQuestNpc.decisionContact(text(row,"npcRole",""));
|
||||
if(contact==null)continue;
|
||||
put(screen,slot++,text(row,"title","Decision"),"Required Reputation: "+text(row,"level","—")+"\n"+contact.name(),Material.BOOK,()->roleDecisionDetails(p,new JsonObject(),contact,row,null,null));
|
||||
}
|
||||
if(slot==9)put(screen,13,"No available decisions","Your current authority and cooldown determine what appears here.",Material.MAP,null);
|
||||
if(current>0)put(screen,45,"Previous page","Earlier decisions",Material.ARROW,()->openDecisions(p,current-1));
|
||||
if(current<last)put(screen,53,"Next page","More decisions",Material.ARROW,()->openDecisions(p,current+1));
|
||||
put(screen,48,"Back","Mission journal",Material.ARROW,()->open(p));
|
||||
put(screen,49,"Website","Decision definitions and history",Material.MAP,()->decisionWebsite(p));
|
||||
show(p,screen);
|
||||
},true);
|
||||
}
|
||||
private void decisionWebsite(Player p){decisionWebsite(p,null);}
|
||||
private void decisionWebsite(Player p,String decision){p.closeInventory();String url="https://clans.dunerealms.com/#quests/quests?xp=pol&view=decisions";if(decision!=null&&decision.matches("[A-Z0-9-]{1,32}"))url+="&decision="+decision;p.sendMessage(Component.text("Review POL decisions on the website →",NamedTextColor.GOLD).clickEvent(ClickEvent.openUrl(url)));}
|
||||
private void roleDecisionDetails(Player p,JsonObject contact,PolQuestNpc.Role role,JsonObject row,String account,String parameter){var screen=panel(p,"NPC turn-in decision · "+role.name());screen.description=dialogue(row,"introduction","");roleAvatar(screen,contact,role);String kind=text(row,"kind","");String fee=text(row,"feeMinor","0");String amount;try{amount=new java.math.BigDecimal(fee).movePointLeft(2).toPlainString()+" DM";}catch(NumberFormatException invalid){amount="—";}put(screen,13,text(row,"title","Decision"),"Required Reputation: "+text(row,"level","—")+"\nBase cost: "+amount+"\nAward: "+text(row,"reputation","—")+" Reputation",Material.BOOK,null);
|
||||
if(kind.equals("website")){put(screen,31,"Open website workflow","This decision requires the existing website controls.",Material.MAP,()->decisionWebsite(p,text(row,"id","")));}
|
||||
else if(account==null&&(!row.has("fundingRequired")||yes(row,"fundingRequired"))){int slot=18;for(var e:row.getAsJsonArray("accounts")){var a=e.getAsJsonObject();if(slot>=35)break;String id=text(a,"id","");try{if(new java.math.BigInteger(text(a,"availableMinor","0")).compareTo(new java.math.BigInteger(fee))<0)continue;}catch(NumberFormatException invalid){continue;}put(screen,slot++,text(a,"name","Funding account"),"Account "+text(a,"number","")+" · available "+new java.math.BigDecimal(text(a,"availableMinor","0")).movePointLeft(2).toPlainString()+" DM",Material.GOLD_INGOT,()->roleDecisionDetails(p,contact,role,row,id,parameter));}}
|
||||
else if(row.has("parameters")&¶meter==null){int slot=18;for(var item:row.getAsJsonArray("parameters")){var value=item.getAsJsonObject();if(slot>=35)break;put(screen,slot++,text(value,"label","Parameter"),"Select this exact parameter",Material.PAPER,()->roleDecisionDetails(p,contact,role,row,account,text(value,"value","")));}}
|
||||
else{String parameterLabel=parameter;if(parameter!=null&&row.has("parameters"))for(var entry:row.getAsJsonArray("parameters")){var option=entry.getAsJsonObject();if(parameter.equals(text(option,"value",""))){parameterLabel=text(option,"label",parameter);break;}}put(screen,22,"Confirmed selection",(account==null?"No separate funding required":"Funding account "+account)+(parameter==null?"":"\nParameter: "+parameterLabel),Material.GOLD_INGOT,null);UUID requestId=UUID.randomUUID();put(screen,31,"Confirm and execute","Commit the reviewed decision once through J.A.R.V.I.S.",Material.LIME_DYE,()->{var input=new JsonObject();input.addProperty("action","execute");input.addProperty("npcRole",role.key());input.addProperty("decisionId",text(row,"id",""));input.addProperty("requestId",requestId.toString());if(account!=null)input.addProperty("sourceAccount",account);input.addProperty("confirmed",true);if(parameter!=null)input.addProperty("parameter",parameter);decisionRequest(p,role,input,result->roleDecisionResult(p,contact,role,row,result));});}
|
||||
put(screen,49,"Back","Current executable decisions",Material.ARROW,()->roleDecisionDashboard(p,contact,role));show(p,screen);
|
||||
else{String parameterLabel=parameter;if(parameter!=null&&row.has("parameters"))for(var entry:row.getAsJsonArray("parameters")){var option=entry.getAsJsonObject();if(parameter.equals(text(option,"value",""))){parameterLabel=text(option,"label",parameter);break;}}put(screen,22,"Confirmed selection",(account==null?"No separate funding required":"Funding account "+account)+(parameter==null?"":"\nParameter: "+parameterLabel),Material.GOLD_INGOT,null);UUID requestId=UUID.randomUUID();put(screen,31,"Enact decision","Record this decision through J.A.R.V.I.S. at "+role.name(),Material.LIME_DYE,()->{var input=new JsonObject();input.addProperty("action","execute");input.addProperty("npcRole",role.key());input.addProperty("decisionId",text(row,"id",""));input.addProperty("requestId",requestId.toString());if(account!=null)input.addProperty("sourceAccount",account);input.addProperty("confirmed",true);if(parameter!=null)input.addProperty("parameter",parameter);decisionRequest(p,role,input,result->roleDecisionResult(p,contact,role,row,result));});}
|
||||
put(screen,49,"Back","Current executable decisions",Material.ARROW,()->openDecisions(p,0));show(p,screen);
|
||||
}
|
||||
private void roleDecisionResult(Player p,JsonObject contact,PolQuestNpc.Role role,JsonObject row,JsonObject result){var screen=panel(p,"NPC next quest decision · "+role.name());screen.description=dialogue(row,"turnIn","");roleAvatar(screen,contact,role);put(screen,13,text(row,"title","Decision"),"Reference: "+text(result,"keyId","Recorded")+"\nReputation: "+text(result,"xp","—"),Material.LIME_DYE,null);put(screen,31,"Next decision","See the remaining current eligible decisions",Material.BOOK,()->roleDecisionDashboard(p,contact,role));put(screen,49,"Later","Return to the contact dashboard",Material.ARROW,()->load(p,"pol",null,null,0));show(p,screen);}
|
||||
private void roleDecisionResult(Player p,JsonObject contact,PolQuestNpc.Role role,JsonObject row,JsonObject result){var screen=panel(p,"NPC next quest decision · "+role.name());screen.description=dialogue(row,"turnIn","");roleAvatar(screen,contact,role);put(screen,13,text(row,"title","Decision"),"Reference: "+text(result,"keyId","Recorded")+"\nReputation: "+text(result,"xp","—"),Material.LIME_DYE,null);put(screen,31,"Next decision","See the remaining current eligible decisions",Material.BOOK,()->openDecisions(p,0));put(screen,49,"Later","Return to the contact dashboard",Material.ARROW,()->load(p,"pol",null,null,0));show(p,screen);}
|
||||
private void decisionRequest(Player p,PolQuestNpc.Role role,JsonObject input,Consumer<JsonObject> callback){try{bridge.questCharacterNpc(p,role.key());request(p,input,callback,true);}catch(Exception unavailable){p.sendMessage("Return to this political quest contact.");}}
|
||||
private void roleSelected(Player p,JsonObject data,PolQuestNpc.Role role,JsonObject row){if(website(row)){details(p,"pol",data,text(row,"branch",""),0,row);return;}if(!Set.of("active","completed").contains(text(row,"state",""))){roleIntro(p,data,role,row);return;}details(p,"pol",data,text(row,"branch",""),0,row);}
|
||||
private void roleIntro(Player p,JsonObject data,PolQuestNpc.Role role,JsonObject row){var screen=panel(p,"NPC next quest · "+role.name());screen.description=dialogue(row,"introduction","");roleAvatar(screen,data,role);put(screen,13,text(row,"title","Next mission"),text(row,"objective","")+"\nReputation: "+text(row,"xp","—"),Material.WRITABLE_BOOK,null);put(screen,30,"Accept","Accept exactly this mission",Material.LIME_DYE,()->act(p,"pol",text(row,"branch",""),0,row,"start"));put(screen,32,"Later","Return to the contact's mission dashboard",Material.ARROW,()->roleJournal(p,data,role,null));show(p,screen);}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ api-version: '1.21.8'
|
|||
depend: [JarvisTranslator]
|
||||
softdepend: [MCGUI, DecentHolograms, DuneLobby, DuneCore, DuneEss, DuneNPC, Vault, floodgate, ViaVersion]
|
||||
commands:
|
||||
decisions:
|
||||
description: List the POL decisions available to your current offices
|
||||
rosterkey:
|
||||
description: Accept a team war roster invitation
|
||||
usage: /rosterkey <code>
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@ class MenuDocumentTest {
|
|||
@Test void warRosterUsesDirectOwnSlotActionsAndReadOnlyOpposingStatus(){
|
||||
var blue=new MenuDocument.Card(2,"Blue · Own",List.of("Your team","6 / 8","Province: arrakis · 1, 2"),"blue_banner",1,false,"");var red=new MenuDocument.Card(6,"Red · Opponent",List.of("Opposing team · read only","7 / 8"),"red_banner",1,false,"");var player=new MenuDocument.Card(19,"<Herald>",List.of(),"player_head",1,true,"");var empty=new MenuDocument.Card(20,"Empty slot 2",List.of(),"light_gray_stained_glass_pane",1,true,"");var launch=new MenuDocument.Card(51,"Launch War",List.of(),"clock",1,false,"");String html=MenuDocument.html("War Muster Room","8 vs 8","Leader",List.of(blue,red,player,empty,launch),-1,Path.of("."));assertTrue(html.contains("WAR MUSTER ROOM"));assertTrue(html.contains("data-slot=\"19\""));assertTrue(html.contains("data-slot=\"20\""));assertFalse(html.contains("data-slot=\"6\""));assertFalse(html.contains("data-slot=\"51\""));assertTrue(html.contains("<Herald>"));
|
||||
}
|
||||
@Test void sharedRoleplayScreensDistinguishDecisionsAndKeepExplicitSelection(){
|
||||
@Test void decisionRowsOpenDetailsDirectly(){
|
||||
var row=new MenuDocument.Card(10,"Imperial passage",List.of("Current eligible decision"),"book",1,true,"");
|
||||
var journal=new MenuDocument.Card(49,"Website journal",List.of(),"map",1,true,"");
|
||||
String before=MenuDocument.html("NPC dashboard decision · Emperor","", "Player",List.of(row,journal),-1,Path.of("."));
|
||||
assertTrue(before.contains("YOUR DECISIONS"));assertTrue(before.contains("data-pick=\"10\""));assertFalse(before.contains("data-slot=\"10\""));
|
||||
String picked=MenuDocument.html("NPC dashboard decision · Emperor","", "Player",List.of(row,journal),10,Path.of("."));
|
||||
assertTrue(picked.contains("data-slot=\"10\">SELECT DECISION"));
|
||||
assertTrue(before.contains("YOUR DECISIONS"));
|
||||
assertTrue(before.contains("data-slot=\"10\""));
|
||||
assertFalse(before.contains("data-pick=\"10\""));
|
||||
assertTrue(MenuDocument.html("NPC next quest decision · Emperor","", "Player",List.of(journal),-1,Path.of(".")).contains("DECISION RECORDED"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,22 +17,29 @@ export function createGamePoliticalDecisionsAPI(db,settings,service,{imperialPas
|
|||
if(!gameAuthorized(request,settings))return json({message:'Unauthorized'},401);
|
||||
if(request.method!=='POST'||new URL(request.url).search||!/^application\/json(?:;|$)/i.test(request.headers.get('content-type')||''))return json({message:'A current native decision request is required.'},400);
|
||||
let input;try{const raw=await request.text();if(raw.length>4096)throw Error();input=JSON.parse(raw);}catch{return json({message:'Invalid decision request.'},400);}
|
||||
const office=roleOffice[input?.npcRole];if(!office||!validUuid(input?.uuid)||!['read','execute'].includes(input?.action))return json({message:'Choose a registered political contact.'},400);
|
||||
const office=Object.hasOwn(roleOffice,input?.npcRole)?roleOffice[input.npcRole]:null;if((!office&&(input?.action!=='read'||Object.hasOwn(input,'npcRole')))||!validUuid(input?.uuid)||!['read','execute'].includes(input?.action))return json({message:'Choose a registered political contact.'},400);
|
||||
try{
|
||||
const users=await db.query("SELECT a.id,a.username,a.display_name,a.role FROM site_accounts a JOIN site_game_links l ON l.user_id=a.id WHERE LOWER(l.minecraft_uuid)=? AND a.password_hash NOT LIKE '!%' AND a.role NOT IN ('system_account','official_account','memorial')",[input.uuid.toLowerCase()]);if(users.length!==1)return json({message:'Link your active player account.'},403);const actor=users[0];
|
||||
if(input.action==='read'){
|
||||
if(Object.keys(input).sort().join(',')!=='action,npcRole,uuid')return json({message:'Identity overrides are not accepted.'},400);
|
||||
const reads=await Promise.allSettled(POLITICAL_DECISIONS.filter(d=>d.office===office).map(async d=>{const r=await service.read(actor,d.id);if(!r.canExecute)return null;const kind=nativeKind(d);return {id:d.id,title:d.title,level:d.level,feeMinor:String(d.feeMinor),reputation:d.xp,dialogue:d.dialogue,kind:kind||'website',accounts:r.accounts||[],...(kind==='tariff'?{parameters:[0,1,2,3,4,5].map(v=>({value:String(v),label:v+'%'}))}:kind==='guild-discount'?{parameters:PASSAGE_HOUSES.map(h=>({value:h.id,label:h.name}))}:{})};}));
|
||||
const additional=[];
|
||||
if(imperialPassage&&office==='emperor')additional.push(async()=>{const r=await imperialPassage.read(actor);return r.canExecute?{id:'IMP-10',title:'Imperial Arrakis passage',kind:'imperial-passage',fundingRequired:false,level:0,feeMinor:'0',reputation:0,parameters:[{value:'none',label:'Revoke additional passage'},...PASSAGE_HOUSES.map(h=>({value:h.id,label:h.name}))],dialogue:{introduction:'Select one native-world House or repeal the previous grant. The next decision is available seven days later.'},accounts:[]}:null;});
|
||||
if(worldTrade)for(const d of TRADE_DECISIONS.filter(d=>d.office===office))additional.push(async()=>{const r=await worldTrade.read(actor,d.id);return r.canExecute?{id:d.id,title:d.title,level:d.level,kind:d.kind==='tax'?'trade-tax':'trade-embargo',fundingRequired:false,feeMinor:'0',reputation:0,parameters:d.kind==='tax'?(r.bankReady?[0,1,2,3,4,5]:[0]).map(v=>({value:String(v),label:v+'%'})):TRADE_WORLDS.map(w=>({value:w.id,label:w.name})),dialogue:{introduction:d.effect},accounts:[]}:null;});
|
||||
if(houseFaith)for(const d of HOUSE_FAITH_DECISIONS.filter(d=>d.office===office))additional.push(async()=>{const r=await houseFaith.read(actor,d.id);return r.canPropose?{id:d.id,title:d.title,level:d.level,kind:'website',dialogue:{introduction:d.effect},accounts:[]}:null;});
|
||||
if(clanFaith)for(const d of CLAN_FAITH_DECISIONS.filter(d=>d.office===office))additional.push(async()=>{const clans=await clanFaith.eligibleClans(actor,office),parameters=clanParameters(clans);return parameters.length?{id:d.id,title:d.title,level:d.level,kind:parameters.length<=17?'faith-conversion':'website',fundingRequired:false,feeMinor:'0',reputation:0,parameters,dialogue:{introduction:d.effect},accounts:[]}:null;});
|
||||
if(faithBlessings&&['veiled_concord','muad_dib'].includes(office))additional.push(async()=>{const r=await faithBlessings.read(actor),eligible=new Map();for(const clan of r.clans||[])for(const d of clan.decisions||[])if(d.available&&d.office===office&&validUuid(clan.id)){if(!eligible.has(d.catalogueId))eligible.set(d.catalogueId,{id:d.catalogueId,title:d.title,kind:'faith-blessing',fundingRequired:false,feeMinor:'0',reputation:0,parameters:[],dialogue:{introduction:d.effect},accounts:[]});eligible.get(d.catalogueId).parameters.push({value:clan.id,label:clan.name});}return [...eligible.values()].map(d=>({...d,parameters:[...new Map(d.parameters.map(p=>[p.value,p])).values()],kind:d.parameters.length<=17?'faith-blessing':'website'}));});
|
||||
if(naibCouncil&&office==='fremen')additional.push(async()=>{const r=await naibCouncil.context(actor);return [...(r.proposalKinds||[]),...(r.rejections?.length?[{canPropose:true,decisionId:'FRE-05'}]:[])].filter(p=>p.canPropose&&p.decisionId).map(p=>{const d=NAIB_COUNCIL_DECISIONS.find(d=>d.id===p.decisionId);return d?{id:d.id,title:d.title,level:d.level,feeMinor:String(d.feeMinor),reputation:d.xp,kind:'website',dialogue:{introduction:d.effect||'Review the current Council proposal, funding and independent sietch vote.'},accounts:[]}:null;}).filter(Boolean);});
|
||||
if(naibPetitions&&office==='fremen')additional.push(async()=>{const r=await naibPetitions.context(actor);return r.canExecute?{id:r.id,title:r.title,level:r.level,feeMinor:String(r.feeMinor),reputation:r.xp,kind:'website',dialogue:{introduction:r.effect},accounts:[]}:null;});
|
||||
const extra=await Promise.allSettled(additional.map(f=>f()));
|
||||
return json({ok:true,decisions:[...reads,...extra].filter(r=>r.status==='fulfilled'&&r.value).flatMap(r=>r.value)});
|
||||
const fields=office?'action,npcRole,uuid':'action,uuid';
|
||||
if(Object.keys(input).sort().join(',')!==fields)return json({message:'Identity overrides are not accepted.'},400);
|
||||
const scoped=Boolean(office);
|
||||
const contacts=scoped?[[input.npcRole,office]]:[...new Map(Object.entries(roleOffice).reverse().map(([role,scope])=>[scope,[role,scope]])).values()];
|
||||
const decisions=[];
|
||||
for(const [npcRole,office] of contacts){
|
||||
const reads=await Promise.allSettled(POLITICAL_DECISIONS.filter(d=>d.office===office).map(async d=>{const r=await service.read(actor,d.id);if(!r.canExecute)return null;const kind=nativeKind(d);return {id:d.id,title:d.title,level:d.level,feeMinor:String(d.feeMinor),reputation:d.xp,dialogue:d.dialogue,kind:kind||'website',accounts:r.accounts||[],...(kind==='tariff'?{parameters:[0,1,2,3,4,5].map(v=>({value:String(v),label:v+'%'}))}:kind==='guild-discount'?{parameters:PASSAGE_HOUSES.map(h=>({value:h.id,label:h.name}))}:{})};}));
|
||||
const additional=[];
|
||||
if(imperialPassage&&office==='emperor')additional.push(async()=>{const r=await imperialPassage.read(actor);return r.canExecute?{id:'IMP-10',title:'Imperial Arrakis passage',kind:'imperial-passage',fundingRequired:false,level:0,feeMinor:'0',reputation:0,parameters:[{value:'none',label:'Revoke additional passage'},...PASSAGE_HOUSES.map(h=>({value:h.id,label:h.name}))],dialogue:{introduction:'Select one native-world House or repeal the previous grant. The next decision is available seven days later.'},accounts:[]}:null;});
|
||||
if(worldTrade)for(const d of TRADE_DECISIONS.filter(d=>d.office===office))additional.push(async()=>{const r=await worldTrade.read(actor,d.id);return r.canExecute?{id:d.id,title:d.title,level:d.level,kind:d.kind==='tax'?'trade-tax':'trade-embargo',fundingRequired:false,feeMinor:'0',reputation:0,parameters:d.kind==='tax'?(r.bankReady?[0,1,2,3,4,5]:[0]).map(v=>({value:String(v),label:v+'%'})):TRADE_WORLDS.map(w=>({value:w.id,label:w.name})),dialogue:{introduction:d.effect},accounts:[]}:null;});
|
||||
if(houseFaith)for(const d of HOUSE_FAITH_DECISIONS.filter(d=>d.office===office))additional.push(async()=>{const r=await houseFaith.read(actor,d.id);return r.canPropose?{id:d.id,title:d.title,level:d.level,kind:'website',dialogue:{introduction:d.effect},accounts:[]}:null;});
|
||||
if(clanFaith)for(const d of CLAN_FAITH_DECISIONS.filter(d=>d.office===office))additional.push(async()=>{const clans=await clanFaith.eligibleClans(actor,office),parameters=clanParameters(clans);return parameters.length?{id:d.id,title:d.title,level:d.level,kind:parameters.length<=17?'faith-conversion':'website',fundingRequired:false,feeMinor:'0',reputation:0,parameters,dialogue:{introduction:d.effect},accounts:[]}:null;});
|
||||
if(faithBlessings&&['veiled_concord','muad_dib'].includes(office))additional.push(async()=>{const r=await faithBlessings.read(actor),eligible=new Map();for(const clan of r.clans||[])for(const d of clan.decisions||[])if(d.available&&d.office===office&&validUuid(clan.id)){if(!eligible.has(d.catalogueId))eligible.set(d.catalogueId,{id:d.catalogueId,title:d.title,kind:'faith-blessing',fundingRequired:false,feeMinor:'0',reputation:0,parameters:[],dialogue:{introduction:d.effect},accounts:[]});eligible.get(d.catalogueId).parameters.push({value:clan.id,label:clan.name});}return [...eligible.values()].map(d=>({...d,parameters:[...new Map(d.parameters.map(p=>[p.value,p])).values()],kind:d.parameters.length<=17?'faith-blessing':'website'}));});
|
||||
if(naibCouncil&&office==='fremen')additional.push(async()=>{const r=await naibCouncil.context(actor);return [...(r.proposalKinds||[]),...(r.rejections?.length?[{canPropose:true,decisionId:'FRE-05'}]:[])].filter(p=>p.canPropose&&p.decisionId).map(p=>{const d=NAIB_COUNCIL_DECISIONS.find(d=>d.id===p.decisionId);return d?{id:d.id,title:d.title,level:d.level,feeMinor:String(d.feeMinor),reputation:d.xp,kind:'website',dialogue:{introduction:d.effect||'Review the current Council proposal, funding and independent sietch vote.'},accounts:[]}:null;}).filter(Boolean);});
|
||||
if(naibPetitions&&office==='fremen')additional.push(async()=>{const r=await naibPetitions.context(actor);return r.canExecute?{id:r.id,title:r.title,level:r.level,feeMinor:String(r.feeMinor),reputation:r.xp,kind:'website',dialogue:{introduction:r.effect},accounts:[]}:null;});
|
||||
const extra=await Promise.allSettled(additional.map(f=>f()));
|
||||
decisions.push(...[...reads,...extra].filter(r=>r.status==='fulfilled'&&r.value).flatMap(r=>r.value).map(d=>scoped?d:({...d,npcRole})));
|
||||
}
|
||||
return json({ok:true,decisions});
|
||||
}
|
||||
const conversion=clanFaithDecision(input.decisionId),blessing=FAITH_BLESSINGS.find(d=>d.catalogueId===input.decisionId);
|
||||
if(conversion||blessing){
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff