001package com.fs.starfarer.api.impl.campaign; 002 003import java.util.ArrayList; 004import java.util.Arrays; 005import java.util.HashMap; 006import java.util.List; 007import java.util.Map; 008 009import java.awt.Color; 010 011import org.lwjgl.input.Keyboard; 012 013import com.fs.starfarer.api.Global; 014import com.fs.starfarer.api.campaign.CampaignFleetAPI; 015import com.fs.starfarer.api.campaign.FactionAPI; 016import com.fs.starfarer.api.campaign.InteractionDialogAPI; 017import com.fs.starfarer.api.campaign.InteractionDialogPlugin; 018import com.fs.starfarer.api.campaign.JumpPointAPI; 019import com.fs.starfarer.api.campaign.JumpPointAPI.JumpDestination; 020import com.fs.starfarer.api.campaign.OptionPanelAPI; 021import com.fs.starfarer.api.campaign.SectorEntityToken; 022import com.fs.starfarer.api.campaign.TextPanelAPI; 023import com.fs.starfarer.api.campaign.VisualPanelAPI; 024import com.fs.starfarer.api.campaign.econ.MarketAPI; 025import com.fs.starfarer.api.campaign.impl.items.WormholeScannerPlugin; 026import com.fs.starfarer.api.campaign.rules.MemKeys; 027import com.fs.starfarer.api.campaign.rules.MemoryAPI; 028import com.fs.starfarer.api.characters.AbilityPlugin; 029import com.fs.starfarer.api.combat.EngagementResultAPI; 030import com.fs.starfarer.api.impl.campaign.abilities.TransponderAbility; 031import com.fs.starfarer.api.impl.campaign.ids.Abilities; 032import com.fs.starfarer.api.impl.campaign.ids.Factions; 033import com.fs.starfarer.api.impl.campaign.ids.MemFlags; 034import com.fs.starfarer.api.impl.campaign.rulecmd.DumpMemory; 035import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MiscCMD; 036import com.fs.starfarer.api.impl.campaign.shared.WormholeManager; 037import com.fs.starfarer.api.impl.campaign.tutorial.TutorialMissionIntel; 038import com.fs.starfarer.api.loading.Description; 039import com.fs.starfarer.api.loading.Description.Type; 040import com.fs.starfarer.api.ui.LabelAPI; 041import com.fs.starfarer.api.util.Misc; 042 043public class JumpPointInteractionDialogPluginImpl implements InteractionDialogPlugin { 044 045 public static final String UNSTABLE_KEY = "$unstable"; 046 public static final String CAN_STABILIZE = "$canStabilize"; 047 048 public static float WORMHOLE_FUEL_USE_MULT = 5f; 049 050 private static enum OptionId { 051 INIT, 052 JUMP_1, 053 JUMP_2, 054 JUMP_3, 055 JUMP_4, 056 JUMP_5, 057 JUMP_6, 058 JUMP_7, 059 JUMP_8, 060 JUMP_9, 061 JUMP_CONFIRM_TURN_TRANSPONDER_ON, 062 JUMP_CONFIRM, 063 STABILIZE, 064 RETRIEVE_ANCHOR, 065 RETRIEVE_ANCHOR_CONFIRM, 066 LEAVE, 067 } 068 069 private InteractionDialogAPI dialog; 070 private TextPanelAPI textPanel; 071 private OptionPanelAPI options; 072 private VisualPanelAPI visual; 073 074 private CampaignFleetAPI playerFleet; 075 private JumpPointAPI jumpPoint; 076 077 protected boolean shownConfirm = false; 078 protected boolean canAfford; 079 080 protected OptionId beingConfirmed = null; 081 082 private List<OptionId> jumpOptions = Arrays.asList( 083 new OptionId [] { 084 OptionId.JUMP_1, 085 OptionId.JUMP_2, 086 OptionId.JUMP_3, 087 OptionId.JUMP_4, 088 OptionId.JUMP_5, 089 OptionId.JUMP_6, 090 OptionId.JUMP_7, 091 OptionId.JUMP_8, 092 OptionId.JUMP_9 093 }); 094 095 096 private static final Color HIGHLIGHT_COLOR = Global.getSettings().getColor("buttonShortcut"); 097 098 public void init(InteractionDialogAPI dialog) { 099 this.dialog = dialog; 100 textPanel = dialog.getTextPanel(); 101 options = dialog.getOptionPanel(); 102 visual = dialog.getVisualPanel(); 103 104 playerFleet = Global.getSector().getPlayerFleet(); 105 jumpPoint = (JumpPointAPI) (dialog.getInteractionTarget()); 106 107 fuelCost = playerFleet.getLogistics().getFuelCostPerLightYear(); 108 float rounded = Math.round(fuelCost); 109 if (fuelCost > 0 && rounded <= 0) rounded = 1; 110 fuelCost = rounded; 111 112 if (isWormhole()) { 113 fuelCost *= WORMHOLE_FUEL_USE_MULT; 114 } else if (jumpPoint.isInHyperspace()) { 115 fuelCost = 0f; 116 } 117 118 canAfford = fuelCost <= playerFleet.getCargo().getFuel(); 119 120 visual.setVisualFade(0.25f, 0.25f); 121 if (jumpPoint.getCustomInteractionDialogImageVisual() != null) { 122 visual.showImageVisual(jumpPoint.getCustomInteractionDialogImageVisual()); 123 } else { 124 if (isWormhole()) { 125 visual.showImagePortion("illustrations", "jump_point_wormhole", 640, 400, 0, 0, 480, 300); 126 } else { 127 if (playerFleet.getContainingLocation().isHyperspace()) { 128 visual.showImagePortion("illustrations", "jump_point_hyper", 640, 400, 0, 0, 480, 300); 129 } else { 130 visual.showImagePortion("illustrations", "jump_point_normal", 640, 400, 0, 0, 480, 300); 131 } 132 } 133 } 134 135// dialog.hideVisualPanel(); 136// dialog.setTextWidth(1000); 137 138 dialog.setOptionOnEscape("Leave", OptionId.LEAVE); 139 140 optionSelected(null, OptionId.INIT); 141 } 142 143 public Map<String, MemoryAPI> getMemoryMap() { 144 return null; 145 } 146 147 private EngagementResultAPI lastResult = null; 148 public void backFromEngagement(EngagementResultAPI result) { 149 // no combat here, so this won't get called 150 } 151 152 public void optionSelected(String text, Object optionData) { 153 if (optionData == null) return; 154 155 if (DumpMemory.OPTION_ID == optionData) { 156 Map<String, MemoryAPI> memoryMap = new HashMap<String, MemoryAPI>(); 157 MemoryAPI memory = dialog.getInteractionTarget().getMemory(); 158 159 memoryMap.put(MemKeys.LOCAL, memory); 160 if (dialog.getInteractionTarget().getFaction() != null) { 161 memoryMap.put(MemKeys.FACTION, dialog.getInteractionTarget().getFaction().getMemory()); 162 } else { 163 memoryMap.put(MemKeys.FACTION, Global.getFactory().createMemory()); 164 } 165 memoryMap.put(MemKeys.GLOBAL, Global.getSector().getMemory()); 166 memoryMap.put(MemKeys.PLAYER, Global.getSector().getCharacterData().getMemory()); 167 168 if (dialog.getInteractionTarget().getMarket() != null) { 169 memoryMap.put(MemKeys.MARKET, dialog.getInteractionTarget().getMarket().getMemory()); 170 } 171 new DumpMemory().execute(null, dialog, null, memoryMap); 172 return; 173 } else if (DevMenuOptions.isDevOption(optionData)) { 174 DevMenuOptions.execute(dialog, (String) optionData); 175 return; 176 } 177 178 OptionId option = (OptionId) optionData; 179 180 if (text != null) { 181 //textPanel.addParagraph(text, Global.getSettings().getColor("buttonText")); 182 dialog.addOptionSelectedText(option); 183 } 184 185 186 boolean unstable = jumpPoint.getMemoryWithoutUpdate().getBoolean(UNSTABLE_KEY); 187 boolean stabilizing = jumpPoint.getMemoryWithoutUpdate().getExpire(UNSTABLE_KEY) > 0; 188 boolean canStabilize = jumpPoint.getMemoryWithoutUpdate().getBoolean(CAN_STABILIZE); 189 boolean canTransverseJump = Global.getSector().getPlayerFleet().hasAbility(Abilities.TRANSVERSE_JUMP); 190 boolean tutorialInProgress = TutorialMissionIntel.isTutorialInProgress(); 191 192 switch (option) { 193 case INIT: 194// dialog.showCustomDialog(600, 400, new CustomDialogDelegate() { 195// public boolean hasCancelButton() { 196// return false; 197// } 198// public CustomUIPanelPlugin getCustomPanelPlugin() { 199// return new ExampleCustomUIPanel(); 200// } 201// public String getConfirmText() { 202// return null; 203// } 204// public String getCancelText() { 205// return null; 206// } 207// public void customDialogConfirm() { 208// System.out.println("CUSTOM Confirmed"); 209// } 210// public void customDialogCancel() { 211// System.out.println("CUSTOM Cancelled"); 212// } 213// public void createCustomDialog(CustomPanelAPI panel) { 214// TooltipMakerAPI text = panel.createUIElement(600f, 200f, true); 215// for (int i = 0; i < 10; i++) { 216// text.addPara("The large amount of kinetic energy delivered to shield systems of enemy craft at close-range typically causes emitter overload, a tactical option often overlooked by inexperienced captains.", 10f); 217// } 218// panel.addUIElement(text).inTL(0, 0); 219// } 220// }); 221 222 if (isWormhole()) { 223 addText("Your fleet approaches the wormhole."); 224 } else { 225 addText(getString("approach")); 226 } 227 228 Description desc = Global.getSettings().getDescription(jumpPoint.getCustomDescriptionId(), Type.CUSTOM); 229 if (desc != null && desc.hasText3()) { 230 addText(desc.getText3()); 231 } 232 233 String noun = "jump-point"; 234 if (isWormhole()) noun = "wormhole"; 235 236 if (unstable) { 237 if (isWormhole() && stabilizing) { 238 float dur = jumpPoint.getMemoryWithoutUpdate().getExpire(UNSTABLE_KEY); 239 240 if (true) { 241 String durStr = "" + (int) dur; 242 String days = "days"; 243 if ((int)dur == 1) { 244 days = "day"; 245 } 246 if ((int)dur <= 0) { 247 days = "day"; 248 durStr = "1"; 249 } 250 251 textPanel.addPara("This wormhole is stabilizing and will become usable " 252 + "within %s " + days + ".", Misc.getHighlightColor(), durStr); 253 } else { 254 String time = Misc.getStringForDays((int) dur); 255 LabelAPI label; 256 if (time.contains("many")) { 257 label = textPanel.addParagraph( 258 "This wormhole is gradually stabilizing, but will not be usable for " + time + "."); 259 } else { 260 label = textPanel.addParagraph( 261 "This wormhole is stabilizing, and should be usable within " + time + "."); 262 } 263 264 label.setHighlightColor(HIGHLIGHT_COLOR); 265 label.setHighlight(time); 266 } 267 268 } else { 269 if (stabilizing && !canTransverseJump) { 270 if (tutorialInProgress) { 271 addText("This jump-point is stabilizing and should be usable within a day at the most."); 272 } else { 273 addText("This jump-point is stabilizing but will not be usable for some time."); 274 } 275 } else { 276 addText("This jump-point is unstable and can not be used."); 277 } 278 279 if (canTransverseJump && !tutorialInProgress ) { 280 addText("Until it restabilizes, hyperspace is only accessible via Transverse Jump."); 281 } 282 } 283 } else { 284 if (!jumpPoint.isInHyperspace()) { 285 if (canAfford) { 286 if (!jumpPoint.getDestinations().isEmpty()) { 287 if (isWormhole()) { 288 addText("The nav computer pings the wormhole terminus, establishing a data connection through drive-field fluctuations. " 289 + "In under a minute, and only a moment of unease as the agrav self-correction settles, the process is complete. " 290 + "Your primary interface unveils a list of possible destinations."); 291 } 292 } 293 textPanel.addParagraph("Activating this " + noun + " to let your fleet pass through will cost " + (int)fuelCost + " fuel."); 294 textPanel.highlightInLastPara(Misc.getHighlightColor(), "" + (int)fuelCost); 295 } else { 296 int fuel = (int) playerFleet.getCargo().getFuel(); 297 if (fuel == 0) { 298 textPanel.addParagraph("Activating this " + noun + " to let your fleet pass through will cost " + (int)fuelCost + " fuel. You have no fuel."); 299 } else { 300 textPanel.addParagraph("Activating this " + noun + " to let your fleet pass through will cost " + (int)fuelCost + " fuel. You only have " + fuel + " fuel."); 301 } 302 textPanel.highlightInLastPara(Misc.getNegativeHighlightColor(), "" + (int)fuelCost, "" + fuel); 303 } 304 } 305 306 if (canAfford) { 307 showWarningIfNeeded(); 308 } 309 } 310 311 if (isWormhole()) { 312 MiscCMD.addWormholeIntelIfNeeded(jumpPoint, textPanel, false); 313 } 314 315 createInitialOptions(); 316 break; 317 case STABILIZE: 318 jumpPoint.getMemoryWithoutUpdate().unset(CAN_STABILIZE); 319 //jumpPoint.getMemoryWithoutUpdate().unset(UNSTABLE_KEY); 320 jumpPoint.getMemoryWithoutUpdate().expire(UNSTABLE_KEY, 1f); 321 322 addText("You load the stabilization algorithm into your jump program and the drive field goes through a series " + 323 "of esoteric fluctuations, their resonance gradually cancelling out the instability in this jump-point."); 324 325 addText("The jump-point should be stable enough to use within a day or so."); 326 327 createInitialOptions(); 328 break; 329 case JUMP_CONFIRM_TURN_TRANSPONDER_ON: 330 AbilityPlugin t = Global.getSector().getPlayerFleet().getAbility(Abilities.TRANSPONDER); 331 if (t != null && !t.isActive()) { 332 t.activate(); 333 } 334 optionSelected(null, beingConfirmed); 335 break; 336 case JUMP_CONFIRM: 337 optionSelected(null, beingConfirmed); 338 break; 339 case RETRIEVE_ANCHOR_CONFIRM: 340 dialog.getTextPanel().addPara( 341 "You give the order. Before long, your ops chief confirms that the wormhole anchor has been stowed in a secure hold on your flagship."); 342 WormholeManager.get().removeWormhole(jumpPoint, dialog); 343 options.clearOptions(); 344 options.addOption("Leave", OptionId.LEAVE, null); 345 options.setShortcut(OptionId.LEAVE, Keyboard.KEY_ESCAPE, false, false, false, true); 346 break; 347 case RETRIEVE_ANCHOR: 348 dialog.getTextPanel().addPara( 349 "This will shut down the wormhole and free up the stable point for other uses."); 350 options.clearOptions(); 351 options.addOption("Confirm your orders", OptionId.RETRIEVE_ANCHOR_CONFIRM, null); 352 353 options.addOption("Abort the operation", OptionId.LEAVE, null); 354 options.setShortcut(OptionId.LEAVE, Keyboard.KEY_ESCAPE, false, false, false, true); 355 break; 356 case LEAVE: 357 Global.getSector().getCampaignUI().setFollowingDirectCommand(true); 358 Global.getSector().setPaused(false); 359 dialog.dismiss(); 360 break; 361 } 362 363 if (jumpOptions.contains(option)) { 364 JumpDestination dest = destinationMap.get(option); 365 if (dest != null) { 366 367 if (!shownConfirm) { 368 SectorEntityToken target = dest.getDestination(); 369 CampaignFleetAPI player = Global.getSector().getPlayerFleet(); 370 if (target != null && target.getContainingLocation() != null && 371 !target.getContainingLocation().isHyperspace() && !player.isTransponderOn()) { 372 List<FactionAPI> wouldBecomeHostile = TransponderAbility.getFactionsThatWouldBecomeHostile(player); 373 boolean wouldMindTOff = false; 374 boolean isPopulated = false; 375 for (MarketAPI market : Global.getSector().getEconomy().getMarkets(target.getContainingLocation())) { 376 if (market.isHidden()) continue; 377 if (market.getFaction().isPlayerFaction()) continue; 378 379 isPopulated = true; 380 if (!market.getFaction().isHostileTo(Factions.PLAYER) && 381 !market.isFreePort() && 382 !market.getFaction().getCustomBoolean(Factions.CUSTOM_ALLOWS_TRANSPONDER_OFF_TRADE)) { 383 wouldMindTOff = true; 384 } 385 } 386 387 if (isPopulated) { 388 if (wouldMindTOff) { 389 textPanel.addPara("Your transponder is off, and patrols " + 390 "in the " + 391 target.getContainingLocation().getNameWithLowercaseType() + 392 " are likely to give you trouble over the fact, if you're spotted."); 393 } else { 394 textPanel.addPara("Your transponder is off, but any patrols in the " + 395 target.getContainingLocation().getNameWithLowercaseType() + 396 " are unlikely to raise the issue."); 397 } 398 399 if (!wouldBecomeHostile.isEmpty()) { 400 String str = "Turning the transponder on now would reveal your hostile actions to"; 401 boolean first = true; 402 boolean last = false; 403 for (FactionAPI faction : wouldBecomeHostile) { 404 last = wouldBecomeHostile.indexOf(faction) == wouldBecomeHostile.size() - 1; 405 if (first || !last) { 406 str += " " + faction.getDisplayNameWithArticle() + ","; 407 } else { 408 str += " and " + faction.getDisplayNameWithArticle() + ","; 409 } 410 } 411 str = str.substring(0, str.length() - 1) + "."; 412 textPanel.addPara(str, Misc.getNegativeHighlightColor()); 413 } 414 415 options.clearOptions(); 416 417 options.addOption("Turn the transponder on and then jump", OptionId.JUMP_CONFIRM_TURN_TRANSPONDER_ON, null); 418 options.addOption("Jump, keeping the transponder off", OptionId.JUMP_CONFIRM, null); 419 beingConfirmed = option; 420 421 options.addOption("Abort the jump", OptionId.LEAVE, null); 422 options.setShortcut(OptionId.LEAVE, Keyboard.KEY_ESCAPE, false, false, false, true); 423 424 shownConfirm = true; 425 return; 426 } 427 } 428 } 429 430 431 432 433// SectorEntityToken token = dest.getDestination(); 434// //System.out.println("JUMP SELECTED"); 435// LocationAPI destLoc = token.getContainingLocation(); 436// LocationAPI curr = playerFleet.getContainingLocation(); 437// 438// Global.getSector().setCurrentLocation(destLoc); 439// curr.removeEntity(playerFleet); 440// destLoc.addEntity(playerFleet); 441// 442// Global.getSector().setPaused(false); 443// playerFleet.setLocation(token.getLocation().x, token.getLocation().y); 444// playerFleet.setMoveDestination(token.getLocation().x, token.getLocation().y); 445 446 if (Global.getSector().getUIData().getCourseTarget() == dialog.getInteractionTarget()) { 447 Global.getSector().getCampaignUI().clearLaidInCourse(); 448 } 449 450 dialog.dismiss(); 451 452 Global.getSector().setPaused(false); 453 Global.getSector().doHyperspaceTransition(playerFleet, jumpPoint, dest); 454 455 playerFleet.getCargo().removeFuel(fuelCost); 456 457 return; 458 } 459 } 460 } 461 462 protected void showWarningIfNeeded() { 463 if (isWormhole()) return; 464 465 if (jumpPoint.getDestinations().isEmpty()) return; 466 JumpDestination dest = jumpPoint.getDestinations().get(0); 467 SectorEntityToken target = dest.getDestination(); 468 if (target == null || target.getContainingLocation() == null) return; 469 470 List<CampaignFleetAPI> fleets = new ArrayList<CampaignFleetAPI>(); 471 boolean hostile = false; 472 float minDist = Float.MAX_VALUE; 473 int maxDanger = 0; 474 for (CampaignFleetAPI other : target.getContainingLocation().getFleets()) { 475 float dist = Misc.getDistance(target, other); 476 if (dist < 1000) { 477 fleets.add(other); 478 if (other.getAI() != null) { 479 hostile |= other.getAI().isHostileTo(Global.getSector().getPlayerFleet()); 480 } else { 481 hostile |= other.getFaction().isHostileTo(Factions.PLAYER); 482 } 483 if (other.getMemoryWithoutUpdate().getBoolean(MemFlags.MEMORY_KEY_PIRATE)) { 484 hostile = true; 485 } 486 if (hostile) { 487 maxDanger = Math.max(maxDanger, Misc.getDangerLevel(other)); 488 } 489 if (dist < minDist) minDist = dist; 490 } 491 } 492 TextPanelAPI text = dialog.getTextPanel(); 493 494 if (maxDanger >= 2) { 495 String noun = "jump-point"; 496 if (isWormhole()) noun = "wormhole"; 497 text.addPara("Warning!", Misc.getNegativeHighlightColor()); 498 Global.getSoundPlayer().playUISound("cr_playership_malfunction", 1f, 0.25f); 499 500 String where = "a short distance away from the exit"; 501 String whereHL = ""; 502 if (minDist < 300) { 503 where = "extremely close to the exit"; 504 whereHL = where; 505 } 506 text.addPara("The jump-point exhibits fluctuations " + 507 "characteristic of drive field activity " + where + ".", 508 Misc.getNegativeHighlightColor(), whereHL); 509 510 text.addPara("A disposable probe sends back a microburst of information: forces " + 511 "near the exit are assesed likely hostile and a possible threat to your fleet.", 512 Misc.getNegativeHighlightColor(), "hostile", "threat"); 513 } 514 } 515 516 private Map<OptionId, JumpDestination> destinationMap = new HashMap<OptionId, JumpDestination>(); 517 private void createInitialOptions() { 518 options.clearOptions(); 519 520 boolean dev = Global.getSettings().isDevMode(); 521 float navigation = Global.getSector().getPlayerFleet().getCommanderStats().getSkillLevel("navigation"); 522 boolean isStarAnchor = jumpPoint.isStarAnchor(); 523 boolean okToUseIfAnchor = isStarAnchor && navigation >= 7; 524 525 okToUseIfAnchor = true; 526 if (isStarAnchor && !okToUseIfAnchor && dev) { 527 addText("(Can always be used in dev mode)"); 528 } 529 okToUseIfAnchor |= dev; 530 531 String noun = "jump-point"; 532 if (isWormhole()) noun = "wormhole"; 533 534 boolean unstable = jumpPoint.getMemoryWithoutUpdate().getBoolean(UNSTABLE_KEY); 535 boolean canStabilize = jumpPoint.getMemoryWithoutUpdate().getBoolean(CAN_STABILIZE); 536 537 if (unstable) { 538 if (canStabilize) { 539 options.addOption("Stabilize the jump-point", OptionId.STABILIZE, null); 540 } 541 } else { 542 if (jumpPoint.getDestinations().isEmpty()) { 543 if (isWormhole()) { 544 addText("This wormhole is not connected to any other termini and is effectively unusable."); 545 } else { 546 addText(getString("noExits")); 547 } 548 } else if (playerFleet.getCargo().getFuel() <= 0 && !canAfford) { 549 //addText(getString("noFuel")); 550 } else if (isStarAnchor && !okToUseIfAnchor) { 551 addText(getString("starAnchorUnusable")); 552 } else if (canAfford) { 553 int index = 0; 554 for (JumpDestination dest : jumpPoint.getDestinations()) { 555 if (index >= jumpOptions.size()) break; 556 OptionId option = jumpOptions.get(index); 557 index++; 558 559 if (isWormhole()) { 560 options.addOption("Initiate a transit to " + dest.getLabelInInteractionDialog(), option, null); 561 562 boolean canUse = WormholeScannerPlugin.canPlayerUseWormholes(); 563 if (!canUse) { 564 options.setEnabled(option, false); 565 options.setTooltip(option, "Using a wormhole requires a wormhole scanner."); 566 } 567 568 } else { 569 options.addOption("Order a jump to " + dest.getLabelInInteractionDialog(), option, null); 570 } 571 destinationMap.put(option, dest); 572 } 573 } 574 } 575 576 if (isWormhole()) { 577 options.addOption("Shut down the wormhole and retrieve the anchor", OptionId.RETRIEVE_ANCHOR, null); 578 } 579 580 options.addOption("Leave", OptionId.LEAVE, null); 581 options.setShortcut(OptionId.LEAVE, Keyboard.KEY_ESCAPE, false, false, false, true); 582 583 if (Global.getSettings().getBoolean("oneClickJumpPoints")) { 584 if (jumpPoint.getDestinations().size() == 1) { 585 dialog.setOpacity(0); 586 dialog.setBackgroundDimAmount(0f); 587 optionSelected(null, OptionId.JUMP_1); 588 } 589 } 590 591 if (Global.getSettings().isDevMode()) { 592 DevMenuOptions.addOptions(dialog); 593 } 594 } 595 596 597 protected OptionId lastOptionMousedOver = null; 598 protected float fuelCost; 599 600 public void optionMousedOver(String optionText, Object optionData) { 601 602 } 603 604 public void advance(float amount) { 605 606 } 607 608 private void addText(String text) { 609 textPanel.addParagraph(text); 610 } 611 612 private void appendText(String text) { 613 textPanel.appendToLastParagraph(" " + text); 614 } 615 616 private String getString(String id) { 617 String str = Global.getSettings().getString("jumpPointInteractionDialog", id); 618 619 String fleetOrShip = "fleet"; 620 if (playerFleet.getFleetData().getMembersListCopy().size() == 1) { 621 fleetOrShip = "ship"; 622 if (playerFleet.getFleetData().getMembersListCopy().get(0).isFighterWing()) { 623 fleetOrShip = "fighter wing"; 624 } 625 } 626 str = str.replaceAll("\\$fleetOrShip", fleetOrShip); 627 628 return str; 629 } 630 631 632 public Object getContext() { 633 return null; 634 } 635 636 public boolean isWormhole() { 637 return jumpPoint.isWormhole(); 638 } 639} 640 641 642