@Override public String getLabel() { return getItem().getName() + " " + getItem().getLastName(); } }
private String getBidLevelTemplate(IAuction auction) { switch (currentBidLevel.get()) { case INITIAL: return messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.noBid", new Object[]{}, locale.getCurrentLocal()); case ONE: return messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.first", new Object[]{}, locale.getCurrentLocal()); case TWO: return messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.second", new Object[]{}, locale.getCurrentLocal()); case DONE: IPlayer newOwner = auction.getBiddingPlayer(); return messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.sold", new Object[]{newOwner.getName(), newOwner.getLastName()}, locale.getCurrentLocal()); default: throw new IllegalStateException("Unhandled state: "+currentBidLevel.get()); } }
/** * Transfer the wares in the specified amounts from the ship into the storage.<br> * PRE: there is a trading office in the city. * @param vessel from which the wares are transfered * @param player owner of the trading office and the vessel * @param city in which the transfer happens * @param amounts map of wares and the amounts that should be transfered. */ public void transferFromVesselToStorage(INavigableVessel vessel, IPlayer player, ICity city, Map<IWare, Integer> amounts) { Optional<ITradingOffice> optOffice = player.findTradingOffice(city); Preconditions.checkArgument(optOffice.isPresent(), "There is no trading office for "+player.getName()+" "+player.getLastName()+" in "+city.getName()); for (IWare ware : amounts.keySet()) { int amount = amounts.get(ware); int avgPrice = vessel.getWare(ware).getAVGPrice(); amount = vessel.unload(ware, amount); optOffice.get().move(ware, amount, avgPrice); if (vessel instanceof IConvoy) { distributeIncomeToConvoyParticipants((IConvoy) vessel, player, avgPrice, amount); } } }
/** * Handling the daily update events. * @param event day change update */ @Subscribe public void handleWeeklyUpdate(ClockTickDayChange event) { for (IPlayer player : players) { for (ICity city : map.getCities()) { try { IReputation reputation = city.getReputation(player); int wareReputation = repCalc.calculateWareReputation(city, player); reputation.addWareReputation(wareReputation); } catch (RuntimeException e) { logger.error("Failed to update reputation for "+player.getName()+" "+player.getLastName()+" in "+city.getName(), e); } } } } @VisibleForTesting
private void addCurrentBidInformation(VBox box, IAuction nextAuction, int index) { if (nextAuction.getBiddingPlayer() == null) { // no bid String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.noBid", new Object[]{}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("noBid"); box.getChildren().add(index, dt); } else { // current bid IPlayer bidder = nextAuction.getBiddingPlayer(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.currentBid", new Object[]{nextAuction.getCurrentBid(), bidder.getName(), bidder.getLastName()}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("currentBid"); box.getChildren().add(index, dt); } box.getChildren().add(dialogHelper.createVerticalSpacer(20)); }
@Override public void run() { clientEventBus.post(new DisplayMessage("ch.sahits.game.graphic.event.task.OpponentsOrder.message1", client.getName(), client.getLastName(),premium)); order = eventHandlerFactory.getSinkConcurrentsShipOrder(client, opponent, 10, premium, null); clientServerEventBus.unregister(order); }
sb.append(player.getName()) .append(" ") .append(player.getLastName())
private void addAuctionDescription(VBox box, IAuction nextAuction) { if (nextAuction instanceof IBuildingAuction) { IBuilding building = ((IBuildingAuction) nextAuction).getAuctionedBuilding(); IPlayer owner = nextAuction.getOwner().get(); String name = owner.getName()+" "+owner.getLastName(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.buildingAuction", new Object[]{modelTranslations.getLocalDisplayName(building), name}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("buildingAuction"); box.getChildren().add(dt); } else { IShip ship = ((IShipAuction)nextAuction).getAuctionedShip(); String name = ship.getOwner().getName()+" "+ship.getOwner().getLastName(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.shipAuction", new Object[]{ship.getName(), name}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("shipAuction"); box.getChildren().add(dt); } box.getChildren().add(dialogHelper.createVerticalSpacer(20)); }
for (IPlayer opponent : residentOponents) { String sb = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBurglarDialog.list", new Object[]{modelTranslator.getLocalDisplayName(opponent.getCareerLevel()), modelTranslator.getLocalDisplayName(opponent.getRank()), opponent.getName(), opponent.getLastName(), opponent.getHometown().getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(sb, new HashMap<>()); text.setUserData(opponent);
private DecoratedText getCandidateRow(ICitizen candidate) { Object[] args; String template; DecoratedText text; if (candidate instanceof IHumanPlayer) { IPlayer p = (IPlayer) candidate; args = new Object[]{modelTranslator.getLocalDisplayDistinctArticle(p.getPersonalData().isMale(), true), modelTranslator.getLocalDisplayName(p.getCareerLevel()), modelTranslator.getLocalDisplayName(p.getRank()), p.getName()+" "+p.getLastName()}; } else { args = new Object[]{modelTranslator.getLocalDisplayDistinctArticle(true, true), modelTranslator.getLocalDisplayName(EEconomicCareer.SMART), modelTranslator.getLocalDisplayName(candidate.getRank()), candidate.getName()+" "+candidate.getLastName()}; } template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.candidate", args, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); return text; }
private DecoratedText getCandidateRow(ICitizen candidate) { Object[] args; String template; DecoratedText text; if (candidate instanceof IPlayer) { IPlayer p = (IPlayer) candidate; args = new Object[]{modelTranslator.getLocalDisplayDistinctArticle(p.getPersonalData().isMale(), true), modelTranslator.getLocalDisplayName(p.getCareerLevel()), modelTranslator.getLocalDisplayName(p.getRank()), p.getName()+" "+p.getLastName()}; } else { args = new Object[]{modelTranslator.getLocalDisplayDistinctArticle(true, true), modelTranslator.getLocalDisplayName(EEconomicCareer.SMART), modelTranslator.getLocalDisplayName(candidate.getRank()), candidate.getName()+" "+candidate.getLastName()}; } template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.candidate", args, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); return text; }
private DecoratedText getCandidateRow(ICitizen candidate, IElectionResult result) { Object[] args; String template; DecoratedText text; if (candidate instanceof IHumanPlayer) { IPlayer p = (IPlayer) candidate; args = new Object[]{modelTranslator.getLocalDisplayDistinctArticle(p.getPersonalData().isMale(), true), modelTranslator.getLocalDisplayName(p.getCareerLevel()), modelTranslator.getLocalDisplayName(p.getRank()), p.getName()+" "+p.getLastName()}; } else { args = new Object[]{modelTranslator.getLocalDisplayDistinctArticle(true, true), modelTranslator.getLocalDisplayName(EEconomicCareer.SMART), modelTranslator.getLocalDisplayName(candidate.getRank()), candidate.getName()+" "+candidate.getLastName()}; } template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.candidate", args, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setOnMouseReleased((evt) -> { result.vote(candidate); executeOnCloseButtonClicked(); }); return text; }
IPlayer member = itemNavigator.getCurrent(); Label header = new Label(member.getName() + " " +member.getLastName()); header.getStyleClass().addAll("subTitle"); header.setId("playerName"); modelTranslations.getLocalDisplayName(member.getRank()), member.getName(), member.getLastName(), member.getHometown().getName(), modelTranslations.toDisplayString(foundingDate), oldest.getCity().getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>());
IShip ship = contract.getOutrigger(); IPlayer owner = (IPlayer) ship.getOwner(); Object[] args = new Object[]{modelTranslator.getLocalDisplayNameWithArticle(ship.getShipType(), true), ship.getName(), modelTranslator.getLocalDisplayName(owner.getCareerLevel()), modelTranslator.getLocalDisplayName(owner.getRank()), owner.getName()+ " "+owner.getLastName()}; template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.OutriggerNoticeDialog.outriggerOwner", args, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>());
col1.getChildren().add(text1); grid.add(col1, 0, row); Text text2 = new Text(owner.getName()+" "+ owner.getLastName()); text2.setId("name-"+index); text2.getStyleClass().add("dialogText");
String d = modelTranslator.toDisplayString(arrivalDate); String loadedText = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernTravelerDialog.dialog", new Object[]{city.getPlayer().getLastName(), modelTranslator.getLocalDisplayName(player.getCareerLevel()), player.getName(), traveler.getDestination().getName(), d}, locale.getCurrentLocal());
@PostConstruct private void initializeDialog() { String letterDate = modelTranslations.toDisplayString(state.getDate()); addDecoratedText("letter.location.date", "dateLocation", Pos.CENTER_RIGHT, state.getLocation(), letterDate); addVerticalSpacer(20); addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.BuildingPermissionDialog.title", "title", Pos.CENTER); addVerticalSpacer(20); IPlayer player = state.getPlayer(); String careerLevel = modelTranslations.getLocalDisplayName(player.getCareerLevel()); String rank = modelTranslations.getLocalDisplayName(player.getRank()); addDecoratedText("letter.salutation.with.title", "salutation", careerLevel, rank, player.getName(), player.getLastName()); addVerticalSpacer(20); addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.BuildingPermissionDialog.permission", "permission", state.getLocation()); addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.BuildingPermissionDialog.greetings", "greetings"); addVerticalSpacer(20); addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.BuildingPermissionDialog.signature", "signature", Pos.CENTER_RIGHT, state.getLocation()); } }
@Override public void run() { ICompany company = debitor.getCompany(); int requiredAmount = debt.getAmount(); int amount = (int) Math.min(requiredAmount, company.getCash()); if (debitor instanceof IHumanPlayer) { company.updateCash(-amount); } else { company.updateCashDirectly(-amount); } if (debt.getCreditor() instanceof IPlayer) { if (debt.getCreditor() instanceof IHumanPlayer) { ((IPlayer) debt.getCreditor()).getCompany().updateCash(amount); } else { ((IPlayer) debt.getCreditor()).getCompany().updateCashDirectly(amount); } if (debt.getCreditor() instanceof IHumanPlayer) { DisplayMessage msg = new DisplayMessage("ch.sahits.game.openpatrician.engine.land.city.LoanerEngine.paybackAfterWithoutAuction", new Object[]{debitor.getName(), debitor.getLastName(), amount}); TargetedEvent message = new TargetedEvent((IHumanPlayer) debt.getCreditor(), msg); clientServerEventBus.post(message); } } } }
} else { logger.debug("Dowry ship {} of {} {} enters port", ship.getName(), player.getName(), player.getLastName()); aiEventHandler.initializeNewShip(ship, (IAIPlayer) player);