forked from unimatrix/web
Show current Spacing Guild fare and destinations from chat
This commit is contained in:
parent
be992d6afa
commit
8750d5c7ae
1 changed files with 18 additions and 2 deletions
|
|
@ -148,6 +148,22 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
player.sendMessage(booking==null?"You have no pending Guild booking.":"Booked to "+booking.world()+" · "+String.format(Locale.ROOT,"%.2f DM",booking.fare()/100.0));
|
||||
return;
|
||||
}
|
||||
if(args.length==1&&args[0].equalsIgnoreCase("quote")){
|
||||
if(!lobby(player)){player.sendMessage("Return to the Spacing Guild to request an outbound fare.");return;}
|
||||
var query=new JsonObject();query.addProperty("action","quote");
|
||||
guildRequest(player,query,quote->{
|
||||
if(quote.has("prologueRequired")&"e.get("prologueRequired").getAsBoolean()){
|
||||
player.sendMessage("Complete the House Prologue before booking Guild passage.");return;
|
||||
}
|
||||
if(!quote.has("fareMinor")){player.sendMessage("The current Guild fare is unavailable.");return;}
|
||||
player.sendMessage("Guild fare: "+String.format(Locale.ROOT,"%.2f DM",quote.get("fareMinor").getAsLong()/100.0)+
|
||||
(quote.has("affordable")&"e.get("affordable").getAsBoolean()?" · Available funds verified.":" · Insufficient available funds."));
|
||||
var destinations=quotedDestinations(quote);
|
||||
player.sendMessage(destinations.isEmpty()?"No current destinations.":"Destinations: "+String.join(", ",new TreeSet<>(destinations)));
|
||||
player.sendMessage("Boarding opens at :00, :20 and :40 for five minutes.");
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(args.length==2&&args[0].equalsIgnoreCase("book")){
|
||||
if(!lobby(player)){player.sendMessage("Return to the Spacing Guild before booking passage.");return;}
|
||||
String destination=args[1].toLowerCase(Locale.ROOT).replace('-','_');
|
||||
|
|
@ -157,7 +173,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
fetch(player,null,0,null,data->bookPassage(player,data,destination,false));
|
||||
return;
|
||||
}
|
||||
player.sendMessage("Use /guildtravel [status|cancel|book <world>].");
|
||||
player.sendMessage("Use /guildtravel [quote|status|cancel|book <world>].");
|
||||
}
|
||||
private void openGuild(Player p,String requested){if(!lobby(p)){try{bridge.returnGuild(p);}catch(Exception unavailable){p.sendMessage("The Guild could not confirm your return. Please retry.");}return;}fetch(p,null,0,null,data->{String house=selection(data);if(house==null){p.sendMessage("Choose and confirm your House before Guild passage.");select(p,data,null);return;}travelMenu(p,data);});}
|
||||
private static GuildBookings.Permit permit(JsonObject data){String house=selection(data);if(house==null||!data.has("keyId")||data.get("keyId").isJsonNull())return null;try{return new GuildBookings.Permit(house,UUID.fromString(data.get("keyId").getAsString()),data.get("version").getAsInt());}catch(RuntimeException invalid){return null;}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff