25 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
26 if (dialog ==
null)
return false;
29 PersonAPI person =
null;
31 Object o = params.get(0).getObject(memoryMap);
32 if (o instanceof PersonAPI) {
33 person = (PersonAPI) o;
35 id = params.get(0).getStringWithTokenReplacement(ruleId, dialog, memoryMap);
38 boolean minimal =
false;
39 boolean showRel =
true;
40 if (params.size() > 1) {
41 minimal = params.get(1).getBoolean(memoryMap);
43 if (params.size() > 2) {
44 showRel = params.get(2).getBoolean(memoryMap);
48 PersonDataAPI data =
Global.
getSector().getImportantPeople().getData(
id);
51 if (dialog.getInteractionTarget() !=
null && dialog.getInteractionTarget().getMarket() !=
null) {
52 if (
id.startsWith(
"POST:")) {
53 String postId =
id.substring(
id.indexOf(
":") + 1);
54 for (CommDirectoryEntryAPI entry : dialog.getInteractionTarget().getMarket().getCommDirectory().getEntriesCopy()) {
55 if (entry.getType() == EntryType.PERSON && entry.getEntryData() instanceof PersonAPI) {
56 PersonAPI curr = (PersonAPI) entry.getEntryData();
57 if (postId.equals(curr.getPostId())) {
64 for (PersonAPI curr : dialog.getInteractionTarget().getMarket().getPeopleCopy()) {
65 if (curr.getId().equals(
id)) {
71 CommDirectoryEntryAPI entry = dialog.getInteractionTarget().getMarket().getCommDirectory().getEntryForPerson(
id);
73 person = (PersonAPI) entry.getEntryData();
79 person = data.getPerson();
83 if (person ==
null)
return false;
85 dialog.getInteractionTarget().setActivePerson(person);
86 ((RuleBasedDialog) dialog.getPlugin()).notifyActivePersonChanged();
87 dialog.getVisualPanel().showPersonInfo(person, minimal, showRel);