private List<IChild> filterNonAdultChildren(IPlayer player) { return player.getChildren().stream() .filter(child -> dateService.getAge(child.getBirthDate()) < 18) .collect(Collectors.toList()); }
public LocalDateTime cleanUpAuctionAndDetermineAuctionDate(LocalDateTime auctionDate, IGuild guild) { if (!guild.getAuctions().isEmpty()) { for (IAuction nextAuction : guild.getAuctions()) { if (dateService.isPast(nextAuction.getAuctionDate())) { nextAuction.setAuctionDate(date.getCurrentDate().plusDays(1)); } while (dateService.isSameDay(nextAuction.getAuctionDate(), auctionDate) ) { auctionDate = auctionDate.plusDays(1); } } } return auctionDate; } }
@Subscribe public void handleDailyUpdate(ClockTickDayChange event) { for (IGuild guild : guildList) { for (IAuction auction : guild.getAuctions()) { if (dateService.isToday(auction.getAuctionDate())) { handleAuction(auction, guild); guild.resetAuction(auction); } } } }
@Subscribe public void checkDayChangeUpdates(ClockTickDayChange dayChange) { ICity town = city.getCity(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getAldermanElectionDate(); if (dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(this::resetContent); } } @Subscribe
addDecoratedText("letter.fullname", "signature", Pos.CENTER_RIGHT, state.getFromFirstName(), state.getFromLastName()); LocalDateTime decisionDeadline = state.getDate().plusDays(14); if (!dateService.isPast(decisionDeadline)) { OpenPatricianLargeWaxButton button = addActionButton("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", "acceptBtn"); button.setOnAction(event -> {
@Override public Integer get() { LocalDateTime now = date.getCurrentDate(); if (now.isAfter(end)) { return 0; } double percentagePassed = dateService.getPercentageBetweenDates(start, end); return (int)Math.rint(maxPremium * (1 - percentagePassed)); } }
@Subscribe public void checkDayChangeUpdates(ClockTickDayChange dayChange) { ICity town = city.getCity(); IPlayer player = city.getPlayer(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getElectionDate(); if (dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(() -> resetContent(town, player)); } } @Subscribe
addDecoratedText("letter.greetings", "grettings", Pos.CENTER); addDecoratedText("letter.fullname", "signature", Pos.CENTER_RIGHT, state.getFromFirstName(), state.getFromLastName()); if (!dateService.isPast(state.getTillDate())) { OpenPatricianLargeWaxButton button = addActionButton("accept.offer", "acceptBtn"); button.setOnAction(createAcceptOffer());
@Subscribe public void checkPostDayChangeUpdates(ElectionWinnerNotification electionResult) { if (displayAtElectionDay && electionResult.getElectionType().equals(EElectionType.ALDERMAN) && electionResult.getCity().equals(city.getCity())) { ICity town = city.getCity(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getAldermanElectionDate(); if (!dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(this::resetContent); } } } private StyleableObjectProperty<Font> font;
if (dateService.isToday(cityHall.getElectionDate())) { electNewMayor(cityHall); } else if (cityHall.getAldermanOffice().isPresent() && dateService.isToday(cityHall.getAldermanElectionDate())) { electNewAlderman(cityHall); } else if (cityHall.getNextCouncilMeeting().isPresent() && cityHall.getPetition().isPresent() && dateService.isToday(cityHall.getNextCouncilMeeting().get())) { voteOnPetition(cityHall); } else if (cityHall.getAldermanOffice().isPresent() && cityHall.getHanseaticMeetingDate().isPresent() && cityHall.getAldermanOffice().get().getViolation().isPresent() && dateService.isToday(cityHall.getHanseaticMeetingDate().get())){ voteOnViolation(cityHall);
@PostConstruct private void initializeDialog() { String letterDate = modelTranslations.toDisplayString(state.getDate()); int age = dateService.getAge(state.getChild().getBirthDate()); addDecoratedText("letter.location.date", "dateLocation", Pos.CENTER_RIGHT, state.getLocation(), letterDate); addVerticalSpacer(20); addDecoratedText("letter.dairy.entry", "diryEntry"); addVerticalSpacer(20); addDecoratedText("ch.sahits.game.openpatrician.display.dialog.event.ChildDeathDialog.childDeath", "childDeath", state.getChild().getName(), age); } }
@Subscribe public void checkPostDayChangeUpdates(ElectionWinnerNotification electionResult) { if (displayAtElectionDay && electionResult.getElectionType().equals(EElectionType.MAYORAL) && electionResult.getCity().equals(city.getCity())) { ICity town = city.getCity(); IPlayer player = city.getPlayer(); ICityHall cityHall = cityHallAccessor.getCityHall(town); final LocalDateTime electionDate = cityHall.getElectionDate(); if (!dateService.isSameDay(electionDate, date.getCurrentDate())) { Platform.runLater(() -> resetContent(town, player)); } } }
if (dateService.isToday(nextAuction.getAuctionDate())) {
box.getChildren().add(text); final LocalDateTime electionDate = cityHall.getElectionDate(); if (dateService.isSameDay(electionDate, date.getCurrentDate())) { template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.electionDay", new Object[]{}, locale.getCurrentLocal()); displayAtElectionDay = true;
VBox content = new VBox(); LocalDateTime electionDate = cityHall.getElectionDate(); if (dateService.isToday(electionDate)) { String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.MeetingRoomDialog.mayoralElection", new Object[]{}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); if (cityHall.getNextCouncilMeeting().isPresent() && dateService.isToday(cityHall.getNextCouncilMeeting().get())) { final Optional<ICityPetition> petition1 = cityHall.getPetition(); ICityPetition petition = petition1.get(); if (dateService.isToday(cityHall.getAldermanElectionDate())) { String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.MeetingRoomDialog.aldermanElection", new Object[]{}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); if (cityHall.getHanseaticMeetingDate().isPresent() && dateService.isToday(cityHall.getHanseaticMeetingDate().get())) { final IAldermanOffice office = cityHall.getAldermanOffice().get(); ICityViolation violation = office.getViolation().get();
if (dateService.isSameDay(electionDate, today)) { String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.HanseaticInfoDialog.electionDay", new Object[]{modelTranslator.toDisplayString(electionDate), alderman.getHometown().getName()}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>());