Revert "Replace the old menu layout with direct actions from the supplied design"
This reverts commit 121b4c7d46.
This commit is contained in:
parent
121b4c7d46
commit
6aa77a3d65
1 changed files with 107 additions and 276 deletions
|
|
@ -189,6 +189,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
String title="Spacing Guild · Imperial passage";
|
||||
int own=Arrays.asList(IDS).indexOf(house);Screen screen=screen(p,title,0xE330+own);
|
||||
var allowedDestinations=quotedDestinations(data.getAsJsonObject("guildQuote"));
|
||||
var routeCards=new ArrayList<DecisionsViewTransport.Card>();
|
||||
for(int i=0;i<GuildRoutes.ALL.size();i++){
|
||||
var route=GuildRoutes.ALL.get(i);boolean allowed=allowedDestinations.contains(route.world());
|
||||
String unavailable="Unavailable · another House world";
|
||||
|
|
@ -199,20 +200,26 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
screen.inventory.setItem(slot,item.clone());
|
||||
if(allowed)screen.actions.put(slot,()->bookPassage(p,data,route.world()));
|
||||
}
|
||||
|
||||
routeCards.add(new DecisionsViewTransport.Card(centre,route.name(),List.of(allowed?
|
||||
(route.house().equals(house)?"Your House":"Imperial passage"):unavailable),allowed,
|
||||
"guild_world_"+route.world()+(allowed?"":"_locked")));
|
||||
}
|
||||
String cancellation="No fare is taken for a cancelled booking";
|
||||
String adviser="Return to your House adviser";
|
||||
button(screen,p,45,"Your Mentat",adviser,Material.ARROW,()->mentat(p,data));screen.actions.put(46,screen.actions.get(45));
|
||||
routeCards.add(new DecisionsViewTransport.Card(45,"Your Mentat",List.of(adviser),true));
|
||||
button(screen,p,49,"Cancel booking",cancellation,Material.BARRIER,()->{cancelBooking(p);travelMenu(p,data);});
|
||||
for(int slot:new int[]{48,50})screen.actions.put(slot,screen.actions.get(49));
|
||||
routeCards.add(new DecisionsViewTransport.Card(49,"Cancel booking",List.of(cancellation),true));
|
||||
if(guild!=null){
|
||||
String bookingLabel=booked==null?"Book passage":"Review booked passage";
|
||||
button(screen,p,53,bookingLabel,detail,Material.EMERALD,()->bookPassage(p,data));screen.actions.put(52,screen.actions.get(53));
|
||||
routeCards.add(new DecisionsViewTransport.Card(53,bookingLabel,List.of(),true));
|
||||
}
|
||||
String nativeDetail=detail;
|
||||
if(booked!=null)nativeDetail+="\nBooked to "+booked.world()+" · "+String.format(Locale.ROOT,"%.2f DM",booked.fare()/100.0);
|
||||
if(MCGUIMenus.show(p,title,nativeDetail,screen.inventory,screen.actions,screen.gate))return;
|
||||
if(NativeMenus.showGuild(this,p,title,nativeDetail,routeCards,screen.actions,screen.gate))return;
|
||||
if(MCGUIMenus.show(p,"Spacing Guild · Imperial passage","",screen.inventory,screen.actions,screen.gate))return;
|
||||
p.openInventory(screen.inventory);expire(screen);
|
||||
}
|
||||
private void cancelBooking(Player p){boolean removed=bookings.cancel(p.getUniqueId());removed=boarding.remove(p.getUniqueId())||removed;p.sendMessage(removed?"Guild passage cancelled. No fare was charged.":"You have no pending Guild booking.");}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff