23 public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
25 SectorEntityToken target = dialog.getInteractionTarget();
27 if (target.getCustomInteractionDialogImageVisual() !=
null) {
28 dialog.getVisualPanel().showImageVisual(target.getCustomInteractionDialogImageVisual());
30 if (target.getMarket() !=
null) {
31 target = target.getMarket().getPlanetEntity();
33 if (target instanceof PlanetAPI) {
36 dialog.getVisualPanel().showPlanetInfo((PlanetAPI) target);
40 }
else if (target instanceof CampaignFleetAPI) {
42 CampaignFleetAPI otherFleet = (CampaignFleetAPI) target;
57 protected void showFleetInfo(InteractionDialogAPI dialog, CampaignFleetAPI player, CampaignFleetAPI other) {
58 BattleAPI b = player.getBattle();
59 if (b ==
null) b = other.getBattle();
60 if (b !=
null && b.isPlayerInvolved()) {
61 String titleOne =
"Your forces";
62 if (b.isPlayerInvolved() && b.getPlayerSide().size() > 1) {
63 titleOne +=
", with allies";
66 titleOne =
"Allied forces";
68 String titleTwo =
null;
69 if (b.getPrimary(b.getNonPlayerSide()) !=
null) {
70 titleTwo = b.getPrimary(b.getNonPlayerSide()).getNameWithFactionKeepCase();
72 if (b.getNonPlayerSide().size() > 1) titleTwo +=
", with allies";
73 dialog.getVisualPanel().showFleetInfo(titleOne, b.getPlayerCombined(), Misc.ucFirst(titleTwo), b.getNonPlayerCombined(),
null);
76 String titleOne = b.getPrimary(b.getSideOne()).getNameWithFactionKeepCase();
77 if (b.getSideOne().size() > 1) titleOne +=
", with allies";
78 String titleTwo = b.getPrimary(b.getSideTwo()).getNameWithFactionKeepCase();
79 if (b.getSideTwo().size() > 1) titleTwo +=
", with allies";
83 dialog.getVisualPanel().showPreBattleJoinInfo(
null, player, Misc.ucFirst(titleOne), Misc.ucFirst(titleTwo), fake);
85 dialog.getVisualPanel().showFleetInfo((String)
null, player, (String)
null, other,
null);