Integrate Wild Update quests and Citizens contacts
This commit is contained in:
parent
018d776874
commit
f46b26d956
1 changed files with 919 additions and 81 deletions
|
|
@ -18,13 +18,17 @@ import net.kyori.adventure.text.event.ClickEvent;
|
|||
final class QuestMenus implements Listener {
|
||||
private final JavaPlugin plugin;private final HouseBridge bridge;private final Consumer<Player> back;
|
||||
private final Map<UUID,UUID> pending=new HashMap<>();
|
||||
private final MissionTracker tracker;
|
||||
private final Map<UUID,JournalView> journals=new HashMap<>();
|
||||
private static final int PAGE=20;
|
||||
private static final class JournalView{final String kind;final List<JournalModel.Arc> arcs;final JsonObject data;int arc,page;String selected;JournalView(String kind,List<JournalModel.Arc> arcs,JsonObject data){this.kind=kind;this.arcs=arcs;this.data=data;}}
|
||||
private final Map<UUID,PolQuestNpc.Role> roleScope=new HashMap<>();
|
||||
private static final class Panel implements InventoryHolder {
|
||||
final UUID owner;final GuiSession gate;final Map<Integer,Runnable> actions=new HashMap<>();final List<BedrockForms.Choice> choices=new ArrayList<>();final Inventory inventory;final String title;String description="Your current J.A.R.V.I.S. mission journal";
|
||||
Panel(Player p,String title){owner=p.getUniqueId();gate=new GuiSession(owner);this.title=title;inventory=Bukkit.createInventory(this,54,Component.text(title,NamedTextColor.GOLD));}
|
||||
public Inventory getInventory(){return inventory;}
|
||||
}
|
||||
QuestMenus(JavaPlugin plugin,HouseBridge bridge,Consumer<Player> back){this.plugin=plugin;this.bridge=bridge;this.back=back;Bukkit.getPluginManager().registerEvents(this,plugin);}
|
||||
QuestMenus(JavaPlugin plugin,HouseBridge bridge,Consumer<Player> back){this.plugin=plugin;this.bridge=bridge;this.back=back;tracker=new MissionTracker(plugin,bridge);Bukkit.getPluginManager().registerEvents(this,plugin);}
|
||||
void quartermaster(Player p,Runnable exchange,Runnable kits){var s=panel(p,"Gurney · Quartermaster");put(s,20,"Exchange","Buy and sell individual items",Material.EMERALD,exchange);put(s,22,"Missions & turn-ins","Collect your House T0 kit or repair its original armour.\nPrepare four parts: one iron ingot, leather, copper ingot and quartz.\nOther missions and rewards use your current central journal.",Material.WRITABLE_BOOK,()->open(p));put(s,24,"Stillsuit kits","Published clan, company and office kits",Material.NETHERITE_CHESTPLATE,kits);put(s,31,"Organisation workshop","Upgrade your held original with researched MK and rarity templates",Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE,()->workshop(p,0));put(s,34,"Gurney\u0027s missions","Current bounty, campaign and ongoing duty missions",Material.BOOK,()->openRole(p,new PolQuestNpc.Role("gurney_halleck","Gurney Halleck",p.getWorld().getName(),"*",Set.of("bounty-jobs","war-service","repeatables","rd"),0)));put(s,49,"Close","Return to the world",Material.ARROW,p::closeInventory);show(p,s);}
|
||||
private static String text(JsonObject row,String key,String fallback){return row.has(key)&&!row.get(key).isJsonNull()?row.get(key).getAsString():fallback;}
|
||||
private static String dialogue(JsonObject row,String field,String fallback){return row.has("dialogue")&&row.get("dialogue").isJsonObject()?text(row.getAsJsonObject("dialogue"),field,fallback):fallback;}
|
||||
|
|
@ -37,8 +41,8 @@ final class QuestMenus implements Listener {
|
|||
if(action!=null){panel.actions.put(slot,action);panel.choices.add(new BedrockForms.Choice(title,description,action));}
|
||||
}
|
||||
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 close(){tracker.close();journals.clear();pending.clear();for(Player p:Bukkit.getOnlinePlayers())if(p.getOpenInventory().getTopInventory().getHolder() instanceof Panel)p.closeInventory();}
|
||||
void open(Player p){roleScope.remove(p.getUniqueId());journals.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 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);});}
|
||||
|
|
@ -52,11 +56,95 @@ final class QuestMenus implements Listener {
|
|||
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,"Smuggler Navigator","Review personal passage to another world.",Material.COMPASS,()->smugglerMenu(p,data,role));
|
||||
if(role.world().equals("arrakis"))put(screen,48,"Smuggling contracts","Start a delivery with Esmar Tuek",Material.CHEST,()->p.performCommand("dunenpc smuggle contract"));
|
||||
if(!role.world().equals("guild_lobby"))put(screen,46,"Smuggler return","Return to the recorded origin of your confirmed passage.",
|
||||
Material.ENDER_PEARL,()->{try{bridge.returnSmuggler(p);}catch(Exception failure){p.sendMessage("Meet Esmar Tuek to confirm your 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);
|
||||
}
|
||||
/** Points the compass at Esmar Tuek and says where he and the roaming smugglers are. */
|
||||
private void findSmuggler(Player p){
|
||||
World world=p.getWorld();Location at=world.getName().equals("arrakis")||world.getName().equals("guild_lobby")?PolQuestNpc.where(plugin,"esmar_tuek",world):null;
|
||||
if(at==null){p.sendMessage("Esmar Tuek can be found near the Arrakis spawn and in the Guild Lobby.");return;}
|
||||
p.setCompassTarget(at);Location here=p.getLocation();
|
||||
p.sendMessage("Esmar Tuek: "+Bearing.describe(at.getX()-here.getX(),at.getZ()-here.getZ())+" (X "+at.getBlockX()+" / Z "+at.getBlockZ()+"). Your compass now points to him.");
|
||||
}
|
||||
|
||||
// ---- Mission journal: story arcs on the left, one mission on the right. Browsing never calls the server. ----
|
||||
private static Material material(String status){return switch(status){case JournalModel.DONE->Material.LIME_DYE;case JournalModel.READY->Material.EMERALD;case JournalModel.ACTIVE->Material.YELLOW_DYE;case JournalModel.AVAILABLE->Material.WRITABLE_BOOK;default->Material.GRAY_DYE;};}
|
||||
private void divider(Panel screen,int slot){var item=new ItemStack(Material.BLACK_STAINED_GLASS_PANE);var meta=item.getItemMeta();meta.displayName(Component.empty());item.setItemMeta(meta);screen.inventory.setItem(slot,item);}
|
||||
private void openJournal(Player p,String kind,JsonObject data,String preferred){
|
||||
var arcs=JournalModel.arcs(data);var view=new JournalView(kind,arcs,data);
|
||||
view.selected=JournalModel.pick(arcs,preferred,tracker.tracked(p.getUniqueId(),kind));focus(view);
|
||||
journals.put(p.getUniqueId(),view);tracker.observe(p,kind,arcs);renderJournal(p,view);
|
||||
}
|
||||
private void focus(JournalView view){
|
||||
for(int a=0;a<view.arcs.size();a++){var list=view.arcs.get(a).missions();for(int i=0;i<list.size();i++)if(list.get(i).id().equals(view.selected)){view.arc=a;view.page=i/PAGE;return;}}
|
||||
view.arc=0;view.page=0;
|
||||
}
|
||||
private void renderJournal(Player p,JournalView view){
|
||||
var screen=panel(p,(view.kind.equals("pol")?"Reputation":"Personal")+" missions");
|
||||
if(view.arcs.isEmpty()){put(screen,22,"No missions yet","Your journal fills as the season opens.",Material.BARRIER,null);put(screen,49,"Back","Mission journal",Material.ARROW,()->open(p));show(p,screen);return;}
|
||||
var arc=view.arcs.get(view.arc);var missions=arc.missions();int pages=Math.max(1,(missions.size()+PAGE-1)/PAGE);view.page=Math.max(0,Math.min(view.page,pages-1));
|
||||
String tracked=tracker.tracked(p.getUniqueId(),view.kind);
|
||||
for(int row=0;row<5;row++)divider(screen,row*9+4);
|
||||
for(int i=0;i<PAGE;i++){
|
||||
int index=view.page*PAGE+i;if(index>=missions.size())break;var m=missions.get(index);int slot=(i/4)*9+(i%4);
|
||||
String lore=JournalModel.label(m.status())+(m.id().equals(tracked)&&!m.finished()?" · Tracked":"")+(m.finished()?"":"\n"+JournalModel.bar(m.progress(),m.target(),10)+" "+m.percent()+"%");
|
||||
put(screen,slot,(m.id().equals(view.selected)?"▶ ":"")+m.title(),lore,material(m.status()),()->{view.selected=m.id();renderJournal(p,view);});
|
||||
}
|
||||
final var sel=JournalModel.find(view.arcs,view.selected);
|
||||
if(sel!=null){
|
||||
String brief=String.join("\n",JournalModel.wrap(JournalModel.briefing(sel.objective(),220),36));
|
||||
put(screen,5,sel.title(),JournalModel.label(sel.status())+(sel.lockedBy()!=null?"\n"+sel.lockedBy():"")+"\n\n"+brief,material(sel.status()),null);
|
||||
String goal=String.join("\n",JournalModel.wrap(sel.objective().isBlank()?sel.title():JournalModel.briefing(sel.objective(),120),36))+"\n"+JournalModel.bar(sel.progress(),sel.target(),16)+"\n"+JournalModel.progressText(sel)+" ("+sel.percent()+"%)";
|
||||
put(screen,14,"Objectives",goal,Material.BOOK,null);
|
||||
String reward=sel.xp()>=0?(view.kind.equals("pol")?"Reputation: ":"Experience: ")+sel.xp()+" XP":"Reward amount unavailable";
|
||||
if(!sel.rewardConfigured())reward+="\nReward not configured yet";
|
||||
put(screen,23,"Rewards",reward,Material.CHEST,null);
|
||||
boolean isTracked=sel.id().equals(tracked);
|
||||
if(!sel.finished()&&!JournalModel.LOCKED.equals(sel.status()))put(screen,41,isTracked?"Tracking":"Track",isTracked?"Shown on your boss bar.":"Show this mission on your boss bar.",Material.COMPASS,isTracked?null:()->{tracker.track(p.getUniqueId(),view.kind,sel.id());tracker.observe(p,view.kind,view.arcs);renderJournal(p,view);});
|
||||
if(!sel.finished()&&!JournalModel.LOCKED.equals(sel.status())&&!sel.webOnly())put(screen,33,"Mission steps","Briefings, turn-ins and special steps\nfor this mission.",Material.BELL,()->{
|
||||
JsonObject row=null;for(var entry:view.data.getAsJsonArray("quests"))if(sel.id().equals(text(entry.getAsJsonObject(),"id","")))row=entry.getAsJsonObject();
|
||||
if(row!=null)details(p,view.kind,view.data,text(row,"branch",""),0,row);});
|
||||
if(sel.webOnly()&&!sel.finished())put(screen,43,"Open website journal","This objective belongs to the website.",Material.MAP,()->website(p));
|
||||
else{
|
||||
if(JournalModel.READY.equals(sel.status())&&sel.canClaim())put(screen,42,"Claim reward","Pay out this mission now.",Material.EMERALD,()->journalAct(p,view.kind,sel,"claim"));
|
||||
if(JournalModel.AVAILABLE.equals(sel.status())&&sel.canStart())put(screen,43,"Start mission","Accept this mission.",Material.LIME_DYE,()->journalAct(p,view.kind,sel,"start"));
|
||||
}
|
||||
}
|
||||
int arcCount=view.arcs.size();
|
||||
if(arcCount>1){
|
||||
put(screen,45,"Previous arc",view.arcs.get((view.arc-1+arcCount)%arcCount).title(),Material.ARROW,()->{view.arc=(view.arc-1+arcCount)%arcCount;view.page=0;view.selected=JournalModel.pick(List.of(view.arcs.get(view.arc)),null,null);renderJournal(p,view);});
|
||||
put(screen,47,"Next arc",view.arcs.get((view.arc+1)%arcCount).title(),Material.ARROW,()->{view.arc=(view.arc+1)%arcCount;view.page=0;view.selected=JournalModel.pick(List.of(view.arcs.get(view.arc)),null,null);renderJournal(p,view);});
|
||||
}
|
||||
put(screen,46,arc.title(),arc.done()+" of "+arc.missions().size()+" done"+(arc.complete()?" · arc complete":""),Material.PAPER,null);
|
||||
if(pages>1){
|
||||
if(view.page>0)put(screen,50,"Previous page","Page "+view.page+" of "+pages,Material.PAPER,()->{view.page--;renderJournal(p,view);});
|
||||
if(view.page<pages-1)put(screen,51,"Next page","Page "+(view.page+2)+" of "+pages,Material.PAPER,()->{view.page++;renderJournal(p,view);});
|
||||
}
|
||||
put(screen,49,"Back","Mission journal",Material.ARROW,()->open(p));put(screen,53,"Website journal","Open your full online journal",Material.MAP,()->website(p));
|
||||
show(p,screen);
|
||||
}
|
||||
private void journalAct(Player p,String kind,JournalModel.Mission m,String action){
|
||||
var input=new JsonObject();input.addProperty("action",action);input.addProperty("kind",kind);input.addProperty("definitionId",m.id());input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("confirmed",true);
|
||||
if(action.equals("claim"))input.addProperty("revision",m.revision());
|
||||
request(p,input,result->{
|
||||
p.sendMessage(Component.text(action.equals("claim")?"Verified quest reward recorded.":"Mission accepted.",NamedTextColor.GREEN));
|
||||
if(action.equals("claim")&&m.id().equals("S1-H-02"))try{bridge.refreshKits(p);}catch(Exception unavailable){p.sendMessage("Your intact replacement remains queued for delivery.");}
|
||||
String next=action.equals("claim")&&result.has("nextQuestId")&&!result.get("nextQuestId").isJsonNull()?result.get("nextQuestId").getAsString():null;
|
||||
journalReload(p,kind,next!=null?next:m.id(),m.id(),action.equals("claim"));
|
||||
});
|
||||
}
|
||||
private void journalReload(Player p,String kind,String preferred,String fromId,boolean advance){
|
||||
var read=new JsonObject();read.addProperty("action","read");read.addProperty("kind",kind);
|
||||
request(p,read,data->{
|
||||
if(!"active".equals(text(data,"state",""))){open(p);return;}
|
||||
var arcs=JournalModel.arcs(data);String pick=preferred;
|
||||
if(advance&&(preferred==null||preferred.equals(fromId))){String next=JournalModel.nextInArc(arcs,fromId);if(next!=null)pick=next;}
|
||||
openJournal(p,kind,data,pick);
|
||||
});
|
||||
}
|
||||
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(text(input,"destination","")))throw new IllegalStateException("That world 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");
|
||||
|
|
@ -148,7 +236,7 @@ final class QuestMenus implements Listener {
|
|||
Bukkit.getScheduler().runTask(plugin,()->{if(!operation.equals(pending.get(owner)))return;pending.remove(owner);if(!p.isOnline()||!world.equals(p.getWorld().getUID()))return;if(message!=null){p.sendMessage(message);return;}if(p.getOpenInventory().getType()!=InventoryType.CRAFTING)return;result.accept(received);});
|
||||
});
|
||||
}
|
||||
private void load(Player p,String kind,String branch,String selected,int page){var input=new JsonObject();input.addProperty("action","read");input.addProperty("kind",kind);var contact=roleScope.get(p.getUniqueId());if(contact!=null&&kind.equals("pol"))input.addProperty("npcRole",contact.key());request(p,input,data->{if(!"active".equals(text(data,"state",""))){p.sendMessage("No active quest season is available.");open(p);return;}var role=roleScope.get(p.getUniqueId());if(role!=null&&kind.equals("pol")){roleJournal(p,data,role,selected);return;}if(branch==null)branches(p,kind,data);else if(selected==null)quests(p,kind,data,branch,page);else{JsonObject row=null;for(var entry:data.getAsJsonArray("quests"))if(selected.equals(text(entry.getAsJsonObject(),"id","")))row=entry.getAsJsonObject();if(row==null)quests(p,kind,data,branch,page);else details(p,kind,data,branch,page,row);}});}
|
||||
private void load(Player p,String kind,String branch,String selected,int page){var input=new JsonObject();input.addProperty("action","read");input.addProperty("kind",kind);var contact=roleScope.get(p.getUniqueId());if(contact!=null&&kind.equals("pol"))input.addProperty("npcRole",contact.key());request(p,input,data->{if(!"active".equals(text(data,"state",""))){p.sendMessage("No active quest season is available.");open(p);return;}var role=roleScope.get(p.getUniqueId());if(role!=null&&kind.equals("pol")){roleJournal(p,data,role,selected);return;}if(branch==null)openJournal(p,kind,data,selected);else if(selected==null)quests(p,kind,data,branch,page);else{JsonObject row=null;for(var entry:data.getAsJsonArray("quests"))if(selected.equals(text(entry.getAsJsonObject(),"id","")))row=entry.getAsJsonObject();if(row==null)quests(p,kind,data,branch,page);else details(p,kind,data,branch,page,row);}});}
|
||||
private void branches(Player p,String kind,JsonObject data){
|
||||
var screen=panel(p,kind.equals("pol")?"Reputation branches":"Personal mission branches");var branches=new LinkedHashMap<String,String>();for(var entry:data.getAsJsonArray("quests")){String id=text(entry.getAsJsonObject(),"branch","missions");branches.putIfAbsent(id,id);}
|
||||
if(data.has("branches"))for(var entry:data.getAsJsonArray("branches")){var branch=entry.getAsJsonObject();String id=text(branch,"id","");if(branches.containsKey(id))branches.put(id,text(branch,"title",id));}
|
||||
|
|
@ -173,7 +261,8 @@ final class QuestMenus implements Listener {
|
|||
else if(yes(row,"canStart")&&!state.equals("active")&&!state.equals("claimed")&&!state.equals("completed"))put(screen,31,"Start mission","Accept this objective through J.A.R.V.I.S.",Material.LIME_DYE,()->act(p,kind,branch,page,row,"start"));
|
||||
else put(screen,31,state.equals("claimed")?"Reward claimed":"Awaiting verified progress","No reward can be issued from an unverified objective",Material.GRAY_DYE,null);
|
||||
if(kind.equals("pol")&&Set.of("POL-ELYTRA-REFINE","POL-ELYTRA-CONTAMINATE","POL-SPICE-UPGRADE-REFINE","POL-SPICE-UPGRADE-CONTAMINATE").contains(text(row,"id",""))&&(yes(row,"canStart")||Set.of("active","completed","claimed").contains(state)))put(screen,33,"Refine at NPC","Stand near an Arrakis Smuggler.\nTurn in the ingredients shown in this quest.",Material.ORANGE_DYE,()->refine(p,kind,data,branch,page,row));
|
||||
if(kind.equals("pol")&&text(row,"id","").equals("POL-SMUGGLERS-01")&&!state.equals("claimed")&&(yes(row,"canStart")||state.equals("active")))put(screen,33,"Meet the underground network","Stand near an Arrakis Smuggler.\nAccept Esmar Tuek’s introduction, then claim the quest.",Material.ORANGE_DYE,()->{try{bridge.smugglerIntroduction(p);p.sendMessage("Introduction recorded. Refresh this quest in a few seconds.");}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Visit an Arrakis Smuggler first.":failure.getMessage());}});
|
||||
if(kind.equals("pol")&&text(row,"id","").equals("POL-SMUGGLERS-01")&&!state.equals("claimed")&&(yes(row,"canStart")||state.equals("active")))put(screen,33,"Meet the underground network","Stand near Esmar Tuek (use Find Esmar Tuek).\nAccept the introduction, then claim the quest.",Material.ORANGE_DYE,()->{try{bridge.smugglerIntroduction(p);p.sendMessage("Introduction recorded. Refresh this quest in a few seconds.");}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Visit Esmar Tuek first.":failure.getMessage());}});
|
||||
if(kind.equals("pol")&&text(row,"id","").equals("POL-SMUGGLERS-01")&&!state.equals("claimed"))put(screen,35,"Find Esmar Tuek","Points your compass at Esmar Tuek and tells you the way.",Material.COMPASS,()->findSmuggler(p));
|
||||
if(kind.equals("pol")&&Set.of("POL-BOUNTY-01","POL-BOUNTY-02").contains(text(row,"id",""))&&!state.equals("claimed"))put(screen,33,"View active bounty jobs","On Arrakis, use the native bounty list and accept a target.",Material.MAP,()->{p.closeInventory();p.performCommand("dune bounty");});
|
||||
if(kind.equals("pol")&&text(row,"id","").equals("POL-ORDOS-03")&&state.equals("active")&&!yes(row,"canClaim"))put(screen,33,"Open Exchange","Buy one item from another seller. The actual settled central payment will verify this mission.",Material.GOLD_INGOT,()->{p.closeInventory();p.performCommand("exchange");});
|
||||
if(kind.equals("pol")&&row.has("research")&&!state.equals("claimed")&&(yes(row,"canStart")||state.equals("active")||state.equals("completed")))put(screen,33,"Submit research samples","Stand near Gurney Halleck.\nSurrender the materials shown in this quest.",Material.SMITHING_TABLE,()->research(p,kind,branch,page,row));
|
||||
|
|
@ -186,9 +275,9 @@ final class QuestMenus implements Listener {
|
|||
if(text(row,"id","").equals("S1-H-02")){put(screen,29,"Prepare four repair parts","Buy, craft with genuine spice or collect native 5% mob drops.\nRepair plate, Binding patch, Tool fitting, Calibration piece.\nOptional: prepare all four from the ordinary materials.",Material.IRON_INGOT,()->starter(p,kind,branch,page,row,"parts"));put(screen,33,"Surrender original kit & parts","Hand in the four original bound armour pieces\nand all four verified repair parts.\nThen claim this quest to receive the intact kit.",Material.ANVIL,()->starter(p,kind,branch,page,row,"repair"));}
|
||||
}
|
||||
if(row.has("recipe")&&!row.get("recipe").isJsonNull())put(screen,22,"Revealed recipe","Craft on Arrakis · Very Rare · MK XI\nNetherite | Membrane | Netherite\nIron | Diamond | Iron\nContaminated spice | Membrane | Contaminated spice",Material.ELYTRA,null);
|
||||
put(screen,45,"Back","Mission selection",Material.ARROW,()->{var currentRole=roleScope.get(p.getUniqueId());if(currentRole!=null&&kind.equals("pol"))roleJournal(p,data,currentRole,null);else quests(p,kind,data,branch,page);});put(screen,49,"Refresh","Read current progress",Material.CLOCK,()->load(p,kind,branch,text(row,"id",""),page));show(p,screen);
|
||||
put(screen,45,"Back","Mission selection",Material.ARROW,()->{var currentRole=roleScope.get(p.getUniqueId());if(currentRole!=null&&kind.equals("pol"))roleJournal(p,data,currentRole,null);else if(journals.containsKey(p.getUniqueId()))journalReload(p,kind,text(row,"id",""),text(row,"id",""),false);else quests(p,kind,data,branch,page);});if(!journals.containsKey(p.getUniqueId()))put(screen,49,"Refresh","Read current progress",Material.CLOCK,()->load(p,kind,branch,text(row,"id",""),page));show(p,screen);
|
||||
}
|
||||
private void refine(Player p,String kind,JsonObject data,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_refine");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.refinerNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.refineSpice(p,permit);p.sendMessage(Component.text("Spice refined. Your quest receipt is queued for confirmation.",NamedTextColor.GREEN));load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Refinement unavailable. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Visit an Arrakis Smuggler first.":failure.getMessage(),NamedTextColor.RED));}}
|
||||
private void refine(Player p,String kind,JsonObject data,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_refine");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.refinerNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.refineSpice(p,permit);p.sendMessage(Component.text("Spice refined. Your quest receipt is queued for confirmation.",NamedTextColor.GREEN));load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Refinement unavailable. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Visit Esmar Tuek first.":failure.getMessage(),NamedTextColor.RED));}}
|
||||
private void research(Player p,String kind,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_research");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.starterNpc(p).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.research(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Research receipt pending. Refresh your quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Visit Gurney Halleck.":failure.getMessage(),NamedTextColor.RED));}}
|
||||
private void meatTurnin(Player p,String kind,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_husbandry_turnin");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.questCharacterNpc(p,"shadout_mapes").toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.husbandryTurnin(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Meat turn-in not confirmed.":failure.getMessage());}});}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Visit Shadout Mapes on Arrakis.":failure.getMessage());}}
|
||||
private void supplyTurnin(Player p,String kind,String branch,int page,JsonObject row){try{var input=new JsonObject();input.addProperty("action","prepare_pol_supply");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("npcUuid",bridge.questCharacterNpc(p,row.getAsJsonObject("supply").get("role").getAsString()).toString());input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.polSupplyTurnin(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Supply turn-in not confirmed.":failure.getMessage());}});}catch(Exception failure){p.sendMessage(failure.getMessage()==null?"Visit the named quest contact.":failure.getMessage());}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff