Archived
0

implement parsing Shipyard from EDCE

This commit is contained in:
iMoHax
2015-10-14 13:03:08 +03:00
parent 75a3e1507c
commit f7bc506508
8 changed files with 131 additions and 26 deletions

View File

@@ -131,7 +131,7 @@
<item name="asp" id="i90"/>
<item name="federal_dropship" id="i94"/>
<item name="type7" id="i88"/>
<item name="federal_assault ship" id="i248"/>
<item name="federal_assault_ship" id="i248"/>
<item name="imperial_clipper" id="i93"/>
<item name="federal_gunship" id="i249"/>
<item name="orca" id="i92"/>

View File

@@ -131,7 +131,7 @@
<item name="asp" id="i95"/>
<item name="federal_dropship" id="i99"/>
<item name="type7" id="i96"/>
<item name="federal_assault ship" id="i100"/>
<item name="federal_assault_ship" id="i100"/>
<item name="imperial_clipper" id="i97"/>
<item name="federal_gunship" id="i101"/>
<item name="orca" id="i102"/>

View File

@@ -150,6 +150,27 @@ public class EDCE {
LOG.warn("Not found {}, id={}", commodity, id);
}
}
Shipyard shipyard = starport.getShips();
if (shipyard != null){
for (ShipyardItem ship : shipyard.getShips()) {
String id = Converter.getShipId(ship);
if (id.isEmpty()){
LOG.debug("{} is ignored, skip", ship.getName());
continue;
}
Optional<ItemModel> item = world.getItem(id);
if (item.isPresent()){
Optional<StationUpdater.FakeOffer> offer = updater.getOffer(item.get());
if (offer.isPresent()){
fillShipOffer(offer.get(), ship);
} else {
LOG.error("Not found offer in updater, item: {}", item.get());
}
} else {
LOG.warn("Not found {}, id={}", ship, id);
}
}
}
StationModel res = updater.commit();
updater.reset();
return res;
@@ -157,9 +178,16 @@ public class EDCE {
private void fillOffers(StationUpdater.FakeOffer offer, Commodity commodity){
offer.setSprice(commodity.getBuyPrice());
offer.setSupply(commodity.getStock());
offer.setBprice(commodity.getSellPrice());
offer.setDemand(commodity.getDemand());
offer.setSupply(commodity.getStock());
}
private void fillShipOffer(StationUpdater.FakeOffer offer, ShipyardItem ship){
offer.setSprice(ship.getBasevalue());
offer.setSupply(1);
offer.setBprice(0);
offer.setDemand(0);
}
private void checkShip(Ship ship){