24 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
26 if (dialog ==
null)
return false;
28 WeightedRandomPicker<PersonAPI> picker =
new WeightedRandomPicker<PersonAPI>();
32 for (PersonAPI person : dialog.getInteractionTarget().getMarket().getPeopleCopy()) {
33 if (person ==
null)
continue;
34 if (person.getMarket() ==
null)
continue;
35 if (person.getMarket().getCommDirectory() ==
null)
continue;
36 if (person.getMarket().getCommDirectory().getEntryForPerson(person.getId()) ==
null)
continue;
38 if (!person.getMarket().getCommDirectory().getEntryForPerson(person.getId()).isHidden()) {
41 Ranks.POST_SUPPLY_OFFICER.equals(person.getPostId()) ||
42 Ranks.POST_PORTMASTER.equals(person.getPostId()) ||
43 Ranks.POST_BASE_COMMANDER.equals(person.getPostId()) ||
44 Ranks.POST_STATION_COMMANDER.equals(person.getPostId())) {
50 int num = Misc.random.nextInt(2) + 2;
51 for (
int i = 0; i < num && !picker.isEmpty(); i++) {
52 PersonAPI person = picker.pickAndRemove();
53 CustomRepImpact custom =
new CustomRepImpact();
54 custom.delta = RepRewards.TINY;
56 new RepActionEnvelope(RepActions.CUSTOM, custom,
57 null, dialog.getTextPanel(),
true,
true),