18 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
19 if (dialog ==
null)
return false;
20 if (!(dialog.getInteractionTarget() instanceof CampaignFleetAPI))
return false;
23 CampaignFleetAPI other = (CampaignFleetAPI) dialog.getInteractionTarget();
26 MemoryAPI memory = memoryMap.get(MemKeys.ENTITY);
28 CargoInspectionResult result = (CargoInspectionResult) memory.get(
"$cargoInspectionResult");
30 for (CargoStackAPI stack : result.getIllegalFound().getStacksCopy()) {
31 playerFleet.getCargo().removeItems(stack.getType(), stack.getData(), stack.getSize());
34 if (playerFleet.getCargo().getCredits().get() >= result.getTollAmount()) {
35 playerFleet.getCargo().getCredits().subtract(result.getTollAmount());