@VisibleForTesting Runnable createRemitRunnable(final IDebt debt) { return () -> { ICreditor creditor = debt.getCreditor(); if (creditor instanceof IPlayer) { ICity city = debt.getDebitor().getHometown(); IReputation reputation = city.getReputation((IPlayer) creditor); reputation.update(500); } }; } @VisibleForTesting
@Subscribe public void handleGameStartEvent(NewGameClient newGameClient) { initialisation.initialisationHappened = true; for (int i = 0; i < initialisation.cities.size(); i++) { ICity city = initialisation.cities.get(i); initializeCity(city); } for (ICityHall cityHall : cityHalls) { if (aldermanCandidates.size() < 4) { aldermanCandidates.add(cityHall.getMayor()); } } ICitizen alderman = aldermanCandidates.get(rnd.nextInt(aldermanCandidates.size())); LocalDateTime election = date.getCurrentDate().plusDays(rnd.nextInt(600)); Optional<IHelpCity> task = stateFactory.createHelpCityAldermanTask(); task.ifPresent(iHelpCity -> aldermanOffice.getTasks().add(iHelpCity)); for (ICityHall cityHall : cityHalls) { ((CityHall)cityHall).setAlderman(alderman); ((CityHall)cityHall).setAldermanElectionDate(election); if (alderman.getHometown().equals(cityHall.getCity())) { Optional<IAldermanOffice> office = Optional.of(aldermanOffice); ((CityHall) cityHall).setAldermanOffice(office); } } } @Subscribe
ICitizen mayor = null; for (ICitizen citizen : city.getCitizen()) { if (councilmen.size() < nbCouncilmen && citizen.getHometown().equals(city)) { final ESocialRank rank = citizen.getRank(); if ((rank == ESocialRank.COUNCILMAN) ||
attribute = modelTranslator.getLocalDisplayName(((IPlayer) alderman).getCareerLevel()); Object[] args = {modelTranslator.getLocalDisplayDistinctArticle(articleMale, false), attribute, alderman.getName() + " " + alderman.getLastName(), alderman.getHometown().getName()}; DecoratedText text; 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<>()); box.getChildren().add(text); text = textFactory.createDecoratedText(template, new HashMap<>()); box.getChildren().add(text); template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.HanseaticInfoDialog.paragraph2", new Object[]{modelTranslator.toDisplayString(electionDate), alderman.getHometown().getName()}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); box.getChildren().add(text);
if (alderman.getHometown().equals(violation.getCity())) { violation.setPunishment(ECityViolationPunishment.NONE); } else {