|
1 | 1 | package starpocalypse.submarket; |
2 | 2 |
|
| 3 | +import com.fs.starfarer.api.Global; |
3 | 4 | import com.fs.starfarer.api.campaign.CargoAPI; |
4 | 5 | import com.fs.starfarer.api.campaign.CargoStackAPI; |
5 | 6 | import com.fs.starfarer.api.campaign.FleetDataAPI; |
|
8 | 9 | import com.fs.starfarer.api.campaign.econ.SubmarketAPI; |
9 | 10 | import com.fs.starfarer.api.fleet.FleetMemberAPI; |
10 | 11 | import com.fs.starfarer.api.impl.campaign.submarkets.MilitarySubmarketPlugin; |
| 12 | +import exerelin.campaign.AllianceManager; |
| 13 | +import exerelin.campaign.PlayerFactionStore; |
| 14 | +import exerelin.utilities.NexUtilsFaction; |
11 | 15 | import lombok.extern.log4j.Log4j; |
12 | 16 | import starpocalypse.config.SimpleMap; |
13 | 17 | import starpocalypse.helper.CargoUtils; |
@@ -65,6 +69,32 @@ public void updateCargoPrePlayerInteraction() { |
65 | 69 | } |
66 | 70 | } |
67 | 71 |
|
| 72 | + @Override |
| 73 | + protected boolean hasCommission() { |
| 74 | + if (Global.getSettings().getModManager().isModEnabled("nexerelin")) { |
| 75 | + return hasCommissionNex(); |
| 76 | + } |
| 77 | + return super.hasCommission(); |
| 78 | + } |
| 79 | + |
| 80 | + private boolean hasCommissionNex() { |
| 81 | + String commissionFaction = NexUtilsFaction.getCommissionFactionId(); |
| 82 | + if (hasCommissionNex(commissionFaction)) { |
| 83 | + return true; |
| 84 | + } |
| 85 | + if (hasCommissionNex(PlayerFactionStore.getPlayerFactionId())) { |
| 86 | + return true; |
| 87 | + } |
| 88 | + return submarket.getFaction().getId().equals(commissionFaction); |
| 89 | + } |
| 90 | + |
| 91 | + private boolean hasCommissionNex(String factionId) { |
| 92 | + if (factionId == null) { |
| 93 | + return false; |
| 94 | + } |
| 95 | + return AllianceManager.areFactionsAllied(factionId, submarket.getFaction().getId()); |
| 96 | + } |
| 97 | + |
68 | 98 | private boolean isStabilityLegal(SimpleMap stabilityMap, float baseValue) { |
69 | 99 | if (!ConfigHelper.wantsRegulation(market.getFactionId())) { |
70 | 100 | return false; |
|
0 commit comments