forked from unimatrix/web
Run starter kit collection and repair from chat
This commit is contained in:
parent
9b78a57168
commit
9fa8061135
1 changed files with 13 additions and 2 deletions
|
|
@ -42,9 +42,10 @@ final class QuestMenus implements Listener {
|
|||
if(args.length==0){open(player);return;}
|
||||
String verb=args[0].toLowerCase(Locale.ROOT);
|
||||
boolean list=verb.equals("list");
|
||||
boolean starterAction=Set.of("obtain","parts","repair").contains(verb);
|
||||
boolean roleStep=Set.of("dossier","cargo","partner").contains(verb);
|
||||
boolean nativeStep=roleStep||Set.of("research","meat","supply","refine").contains(verb);
|
||||
if((roleStep?args.length<3||args.length>5:args.length!=(list?2:3))||!nativeStep&&!Set.of("list","show","start","claim","briefing").contains(verb)||
|
||||
if((roleStep?args.length<3||args.length>5:args.length!=(list?2:3))||!nativeStep&&!starterAction&&!Set.of("list","show","start","claim","briefing").contains(verb)||
|
||||
!Set.of("personal","pol").contains(args[1].toLowerCase(Locale.ROOT))){
|
||||
player.sendMessage("Use /missions list <personal|pol> or /missions <show|start|claim|briefing> <personal|pol> <id>. POL steps: /missions <research|meat|supply|refine> pol <id>.");
|
||||
return;
|
||||
|
|
@ -60,6 +61,13 @@ final class QuestMenus implements Listener {
|
|||
if(!id.equalsIgnoreCase(args[2]))continue;
|
||||
if(website(row)){website(player);return;}
|
||||
String state=text(row,"state","");
|
||||
if(starterAction){
|
||||
String expected=verb.equals("obtain")?"S1-H-01":"S1-H-02";
|
||||
if(kind.equals("personal")&&id.equals(expected)&&(yes(row,"canStart")||Set.of("active","completed","claimed").contains(state))){
|
||||
starter(player,kind,text(row,"branch",""),0,row,verb,false);
|
||||
}else player.sendMessage("This starter-equipment action is unavailable for the current mission.");
|
||||
return;
|
||||
}
|
||||
if(roleStep){roleMissionCommand(player,kind,data,row,verb,Arrays.copyOfRange(args,3,args.length));return;}
|
||||
if(nativeStep){nativeMissionStep(player,kind,row,verb);return;}
|
||||
if(verb.equals("briefing")){
|
||||
|
|
@ -71,6 +79,8 @@ final class QuestMenus implements Listener {
|
|||
player.sendMessage(id+" · "+text(row,"title","Mission")+" · "+state);
|
||||
player.sendMessage(text(row,"objective","Complete the verified objective."));
|
||||
player.sendMessage("Progress: "+text(row,"progress","0")+" / "+text(row,"target","0"));
|
||||
if(kind.equals("personal")&&id.equals("S1-H-01"))player.sendMessage("Starter kit: /missions obtain personal "+id);
|
||||
if(kind.equals("personal")&&id.equals("S1-H-02"))player.sendMessage("Starter repair: /missions parts personal "+id+" or /missions repair personal "+id);
|
||||
if(state.equals("active")&&!yes(row,"canClaim")&&text(row,"metric","").equals("citizen-introduction")){
|
||||
player.sendMessage(CITIZEN_BRIEFING);
|
||||
player.sendMessage("Record it with /missions briefing "+kind+" "+id+".");
|
||||
|
|
@ -364,7 +374,8 @@ final class QuestMenus implements Listener {
|
|||
private void cargoPartners(Player p,JsonObject data,PolQuestNpc.Role role,JsonObject row,int page){var cargo=row.getAsJsonObject("cargo");var screen=panel(p,"NPC turn-in · "+role.name());screen.description="";roleAvatar(screen,data,role);var candidates=cargo.has("candidates")?cargo.getAsJsonArray("candidates"):new JsonArray();int offset=page*30,slot=9;for(int i=offset;i<Math.min(offset+30,candidates.size());i++){var candidate=candidates.get(i).getAsJsonObject();String id=text(candidate,"id","");put(screen,slot++,text(candidate,"name","Eligible partner"),"Offer this exact cooperative assignment",Material.PLAYER_HEAD,()->cargoPartner(p,role,row,"offer",id));}if(candidates.size()==0)put(screen,13,"No current eligible partners","A matching active mission and current affiliation are required.",Material.CLOCK,null);if(page>0)put(screen,45,"Previous","More eligible partners",Material.ARROW,()->cargoPartners(p,data,role,row,page-1));if(offset+30<candidates.size())put(screen,53,"Next","More eligible partners",Material.ARROW,()->cargoPartners(p,data,role,row,page+1));put(screen,49,"Back","Selected mission",Material.ARROW,()->details(p,"pol",data,text(row,"branch",""),0,row));show(p,screen);}
|
||||
private void cargoPartner(Player p,PolQuestNpc.Role role,JsonObject row,String phase,String id){cargoPartner(p,role,row,phase,id,true);}
|
||||
private void cargoPartner(Player p,PolQuestNpc.Role role,JsonObject row,String phase,String id,boolean reopen){try{var input=new JsonObject();input.addProperty("action","cargo_partner");input.addProperty("kind","pol");input.addProperty("definitionId",text(row,"id",""));input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("confirmed",true);input.addProperty("npcRole",role.key());input.addProperty("npcUuid",bridge.questCharacterNpc(p,role.key()).toString());input.addProperty("phase",phase);input.addProperty(phase.equals("offer")?"partnerId":"pairId",id);request(p,input,result->{if(reopen)load(p,"pol",text(row,"branch",""),text(row,"id",""),0);else p.sendMessage("Cooperative assignment updated.");});}catch(Exception unavailable){p.sendMessage("Meet Edric with your current cooperative mission.");}}
|
||||
private void starter(Player p,String kind,String branch,int page,JsonObject row,String operation){try{var input=new JsonObject();input.addProperty("action","prepare_starter");input.addProperty("kind","personal");input.addProperty("definitionId",text(row,"id",""));input.addProperty("operation",operation);input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("access","journal");input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.starterKit(p,permit);load(p,kind,branch,text(row,"id",""),page);}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Your equipment exchange remains available. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Open /start in Survival or Adventure mode.":failure.getMessage(),NamedTextColor.RED));}}
|
||||
private void starter(Player p,String kind,String branch,int page,JsonObject row,String operation){starter(p,kind,branch,page,row,operation,true);}
|
||||
private void starter(Player p,String kind,String branch,int page,JsonObject row,String operation,boolean reopen){try{var input=new JsonObject();input.addProperty("action","prepare_starter");input.addProperty("kind","personal");input.addProperty("definitionId",text(row,"id",""));input.addProperty("operation",operation);input.addProperty("requestId",UUID.randomUUID().toString());input.addProperty("access","journal");input.addProperty("confirmed",true);request(p,input,permit->{try{bridge.starterKit(p,permit);if(reopen)load(p,kind,branch,text(row,"id",""),page);else p.sendMessage("Starter equipment action submitted. Check /missions show personal "+text(row,"id","")+" for progress.");}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Your equipment exchange remains available. Reopen the quest.":failure.getMessage(),NamedTextColor.RED));}});}catch(Exception failure){p.sendMessage(Component.text(failure.getMessage()==null?"Open /start in Survival or Adventure mode.":failure.getMessage(),NamedTextColor.RED));}}
|
||||
private static final String CITIZEN_BRIEFING="Your House determines normal travel authority.\nGuild travel uses boarding windows and your central bank.\nClan and company actions follow current deeds.\nBlue missions require ingame actions or item turn-ins.\nWebsite missions use your linked website account.\nRead your Mentat Report for current news and duties.";
|
||||
private void recordCitizenBriefing(Player player){
|
||||
try{
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff