diff --git a/client/src/main/java/ru/trader/controllers/MissionsController.java b/client/src/main/java/ru/trader/controllers/MissionsController.java index 085b89a..90d472e 100644 --- a/client/src/main/java/ru/trader/controllers/MissionsController.java +++ b/client/src/main/java/ru/trader/controllers/MissionsController.java @@ -24,6 +24,8 @@ public class MissionsController { @FXML private NumberField quantity; @FXML + private NumberField leftTime; + @FXML private NumberField reward; @FXML private ToggleButton courierBtn; @@ -52,6 +54,7 @@ public class MissionsController { starportText.setDisable(false); cargo.setDisable(true); quantity.setDisable(true); + leftTime.setDisable(false); reward.setDisable(false); } else if (deliveryBtn.equals(n)){ @@ -59,6 +62,7 @@ public class MissionsController { starportText.setDisable(false); cargo.setDisable(true); quantity.setDisable(false); + leftTime.setDisable(false); reward.setDisable(false); } else if (supplyBtn.equals(n)){ @@ -69,12 +73,14 @@ public class MissionsController { starportText.setDisable(false); cargo.setDisable(false); quantity.setDisable(false); + leftTime.setDisable(false); reward.setDisable(false); } else { missionType = null; starportText.setDisable(true); cargo.setDisable(true); quantity.setDisable(true); + leftTime.setDisable(true); reward.setDisable(true); } }); @@ -108,14 +114,15 @@ public class MissionsController { StationModel station = starport.getValue(); ItemModel item = cargo.getValue(); long count = quantity.getValue().longValue(); + long time = leftTime.getValue().longValue(); double profit = reward.getValue().doubleValue(); if (station != null && profit > 0){ switch (missionType){ - case COURIER: missions.add(new MissionModel(station, profit)); + case COURIER: missions.add(new MissionModel(station, time, profit)); break; - case DELIVERY: if (count > 0) missions.add(new MissionModel(station, count, profit)); + case DELIVERY: if (count > 0) missions.add(new MissionModel(station, count, time, profit)); break; - case SUPPLY: if (item != null && count > 0) missions.add(new MissionModel(station, item, count, profit)); + case SUPPLY: if (item != null && count > 0) missions.add(new MissionModel(station, item, count, time,profit)); break; } } diff --git a/client/src/main/java/ru/trader/model/MissionModel.java b/client/src/main/java/ru/trader/model/MissionModel.java index 5524095..e5c4fe1 100644 --- a/client/src/main/java/ru/trader/model/MissionModel.java +++ b/client/src/main/java/ru/trader/model/MissionModel.java @@ -14,22 +14,24 @@ public class MissionModel { private final long count; private final double profit; private final Offer offer; + private final Long time; private long need; private Collection reserves; - public MissionModel(StationModel target, double profit) { - this(target, null, 0, profit); + public MissionModel(StationModel target, long time, double profit) { + this(target, null, 0, time, profit); } - public MissionModel(StationModel target, long count, double profit) { - this(target, null, count, profit); + public MissionModel(StationModel target, long count, long time, double profit) { + this(target, null, count, time, profit); } - public MissionModel(StationModel target, ItemModel item, long count, double profit) { + public MissionModel(StationModel target, ItemModel item, long count, long time, double profit) { this.target = target; this.item = item; this.count = count; + this.time = time; this.profit = profit; if (item != null) { offer = SimpleOffer.fakeBuy(ModelFabric.get(target), ModelFabric.get(item), profit / count, count); @@ -44,6 +46,7 @@ public class MissionModel { this.target = mission.target; this.item = mission.item; this.count = mission.count; + this.time = mission.time; this.profit = mission.profit; this.offer = mission.offer; this.need = mission.need; @@ -93,6 +96,7 @@ public class MissionModel { "target=" + target + ", item=" + item + ", count=" + count + + ", time=" + time + ", profit=" + profit + "} "; } @@ -100,13 +104,16 @@ public class MissionModel { public void toSpecification(CrawlerSpecificator specificator){ if (isSupply()){ if (isCompleted()){ - specificator.add(ModelFabric.get(target), true); + if (time == 0) specificator.add(ModelFabric.get(target), true); + else specificator.add(ModelFabric.get(target), time, true); } else { - specificator.buy(offer); + if (time == 0) specificator.buy(offer); + else specificator.buy(offer, time); } } else if (isCourier() || isDelivery()){ - specificator.add(ModelFabric.get(target), true); + if (time == 0) specificator.add(ModelFabric.get(target), true); + else specificator.add(ModelFabric.get(target), time, true); } } @@ -148,6 +155,7 @@ public class MissionModel { MissionModel that = (MissionModel) o; return Objects.equals(count, that.count) && Objects.equals(profit, that.profit) && + Objects.equals(time, that.time) && Objects.equals(target, that.target) && Objects.equals(item, that.item); } diff --git a/client/src/main/resources/lang/locale_en_US.properties b/client/src/main/resources/lang/locale_en_US.properties index 892eadf..0de74e1 100644 --- a/client/src/main/resources/lang/locale_en_US.properties +++ b/client/src/main/resources/lang/locale_en_US.properties @@ -178,4 +178,5 @@ verify.content=Confirmation code: missions.label.starport=Starport: missions.label.cargo=Cargo: missions.label.quantity=Quantity: +missions.label.leftTime=Time left: missions.label.reward=Reward: \ No newline at end of file diff --git a/client/src/main/resources/lang/locale_ru_RU.properties b/client/src/main/resources/lang/locale_ru_RU.properties index d95ac1a..727d042 100644 --- a/client/src/main/resources/lang/locale_ru_RU.properties +++ b/client/src/main/resources/lang/locale_ru_RU.properties @@ -179,4 +179,5 @@ verify.content=\u041A\u043E\u0434 \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u04 missions.label.starport=\u041A\u043E\u0441\u043C\u043E\u043F\u043E\u0440\u0442: missions.label.cargo=\u0413\u0440\u0443\u0437: missions.label.quantity=\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E: +missions.label.leftTime=\u0412\u0440\u0435\u043C\u044F: missions.label.reward=\u041D\u0430\u0433\u0440\u0430\u0434\u0430: \ No newline at end of file diff --git a/client/src/main/resources/view/missions.fxml b/client/src/main/resources/view/missions.fxml index 8b04729..f2094c1 100644 --- a/client/src/main/resources/view/missions.fxml +++ b/client/src/main/resources/view/missions.fxml @@ -42,6 +42,8 @@