I am implementing a Hyperspace Skype(tm). Via intel UI of course.
I would like to tap into rules.csv via `IntelUIAPI.shoDialog(token, ruleId)`. My first surprise was that it doesn't work with rule ids. It takes triggers instead.
Either way, got a bad version of it working (via `market.getPlanetEntity(), "OpenInteractionDialog"`) which does the job, but I want better. I want to OpenCDE (OpenCommLink?) with the person directly. Unfortunately, we don't have sources for that class and I don't know what memory keys are needed. So I seek guidance. Or is there a different way to open dialog with a specific person?
Edit: The reason I went through rules.csv route is that if I create my custom InteractionDialogPlugin and showCommsDirectory with desired people myself, they are no longer clickable / interactable.'
Edit 2: Did some variations of the following with no luck
SectorEntityToken token = market.getPlanetEntity();
token.setActivePerson(person);
ui.showDialog(token, "OpenCDE");
Edit 3: Hmm, been comparing memory dumps from when I access contact via CommDirectory and when I access it manually. I do seem to be missing `$entity` keys, and all local keys point to market (`fullName = Hegemony Jangala` instead of contact name). The hunt for right memory keys continues...
Edit 4: MemoryAPI key overwritting not possible (tried to replace $id that had market with personId, gets overwritten anyway, adding new one is fine), should I look into custom rulecmd (extend BaseCommandPlugin and set things up from there)?
Edit 5: I am slowly loosing hope. Might need a new API method: `ui.showDialog(PersonAPI person, String ruleCmd)` or so (since token in rules can either be Person or Market).
Edit 6: I am now suspecting a bug. When I set active person on the token that's passed to the dialog, I'd expect the memory map to reflect that. I see this used in `BeginConversation`. But in my own tiny code this does not seem to work.
Edit 7: A new hope. Found RuleBasedInteractionDialogPluginImpl. Extending that, and updating interaction target manually kinda works (why it didin't when I modified original token used in calling showDialog?). Hunt continues.
Edit 8: SUCCESS! Took only 5h.
public class ContactDialog extends RuleBasedInteractionDialogPluginImpl {
private final PersonAPI person;
public ContactDialog(PersonAPI person) {
super("OpenCDE");
this.person = person;
}
@Override
public void init(InteractionDialogAPI dialog) {
dialog.getInteractionTarget().setActivePerson(person);
super.init(dialog);
}
}
Two problems:
1. As mentioned, the SectorEntityToken that I to set active person on (prior to calling showDialog) seems to be ignored. Had to set it manually in init again.
2. When cutting the comm link with the person, I am moved to market interaction (first time I am moved twice, to non-existent commdirectory, then to market; second and after straight to market). But I should have this covered - just higher priority rule, based on some extra key I will set, to avoid market interaction and just close the dialog.