1package com.fs.starfarer.api.impl.campaign.tutorial;
6import java.util.Random;
9import com.fs.starfarer.api.EveryFrameScript;
10import com.fs.starfarer.api.Global;
11import com.fs.starfarer.api.campaign.CampaignFleetAPI;
12import com.fs.starfarer.api.campaign.CargoAPI;
13import com.fs.starfarer.api.campaign.CommDirectoryEntryAPI;
14import com.fs.starfarer.api.campaign.CommDirectoryEntryAPI.EntryType;
15import com.fs.starfarer.api.campaign.FactionAPI;
16import com.fs.starfarer.api.campaign.InteractionDialogAPI;
17import com.fs.starfarer.api.campaign.PlanetAPI;
18import com.fs.starfarer.api.campaign.SectorEntityToken;
19import com.fs.starfarer.api.campaign.StarSystemAPI;
20import com.fs.starfarer.api.campaign.TextPanelAPI;
21import com.fs.starfarer.api.campaign.econ.MarketAPI;
22import com.fs.starfarer.api.campaign.rules.MemoryAPI;
23import com.fs.starfarer.api.characters.PersonAPI;
24import com.fs.starfarer.api.fleet.FleetMemberAPI;
25import com.fs.starfarer.api.fleet.FleetMemberType;
26import com.fs.starfarer.api.impl.campaign.JumpPointInteractionDialogPluginImpl;
27import com.fs.starfarer.api.impl.campaign.ids.Abilities;
28import com.fs.starfarer.api.impl.campaign.ids.Commodities;
29import com.fs.starfarer.api.impl.campaign.ids.Entities;
30import com.fs.starfarer.api.impl.campaign.ids.Factions;
31import com.fs.starfarer.api.impl.campaign.ids.MemFlags;
32import com.fs.starfarer.api.impl.campaign.ids.Ranks;
33import com.fs.starfarer.api.impl.campaign.ids.Stats;
34import com.fs.starfarer.api.impl.campaign.ids.Submarkets;
35import com.fs.starfarer.api.impl.campaign.ids.Tags;
36import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
37import com.fs.starfarer.api.impl.campaign.intel.SystemBountyIntel;
38import com.fs.starfarer.api.impl.campaign.intel.SystemBountyManager;
39import com.fs.starfarer.api.impl.campaign.rulecmd.AddRemoveCommodity;
40import com.fs.starfarer.api.impl.campaign.submarkets.StoragePlugin;
41import com.fs.starfarer.api.loading.WeaponSlotAPI;
42import com.fs.starfarer.api.ui.HintPanelAPI;
43import com.fs.starfarer.api.ui.SectorMapAPI;
44import com.fs.starfarer.api.ui.TooltipMakerAPI;
45import com.fs.starfarer.api.util.Misc;
46import com.fs.starfarer.api.util.Misc.Token;
52 public static final String
REASON =
"tut";
54 public static enum TutorialMissionStage {
90 protected TutorialMissionStage
stage = TutorialMissionStage.INIT;
156 if (entry.getType() == EntryType.PERSON && entry.getEntryData() instanceof
PersonAPI) {
174 if (
stage != TutorialMissionStage.INIT) {
199 if (player ==
null)
return;
211 if (
stage == TutorialMissionStage.GO_GET_AI_CORE) {
214 if (cores > 0 && (!
probe.
isAlive() || distToProbe < 300)) {
218 updateStage(TutorialMissionStage.GOT_AI_CORE,
null);
222 if (
stage == TutorialMissionStage.GO_RECOVER_SHIPS) {
231 String
id = entity.getCustomEntityType();
232 if (
id ==
null)
continue;
243 updateStage(TutorialMissionStage.RECOVERED_SHIPS,
null);
247 if (
stage == TutorialMissionStage.GO_STABILIZE) {
251 if (innerStable || fringeStable) {
256 updateStage(TutorialMissionStage.STABILIZED,
null);
265 String action = params.get(0).getString(memoryMap);
273 if (action.equals(
"startGetData")) {
284 updateStage(TutorialMissionStage.GO_GET_DATA, text);
289 }
else if (action.equals(
"endGetData")) {
300 }
else if (action.equals(
"goSalvage")) {
306 updateStage(TutorialMissionStage.GO_GET_AI_CORE, text);
309 }
else if (action.equals(
"goRecover")) {
321 updateStage(TutorialMissionStage.GO_RECOVER_SHIPS, text);
322 }
else if (action.equals(
"goStabilize")) {
333 updateStage(TutorialMissionStage.GO_STABILIZE, text);
337 }
else if (action.equals(
"pickJangalaContact")) {
352 fuel = (float) (Math.ceil(fuel / 10) * 10);
353 mem.
set(
"$jangalaFuel", (
int) fuel);
354 }
else if (action.equals(
"deliverReport")) {
366 updateStage(TutorialMissionStage.DELIVER_REPORT, text);
372 }
else if (action.equals(
"reportDelivered")) {
388 }
else if (action.equals(
"doRepairs")) {
390 member.getRepairTracker().setMothballed(
false);
391 member.getStatus().repairFully();
392 float max = member.getRepairTracker().getMaxCR();
393 max = Math.max(max, .7f);
394 float curr = member.getRepairTracker().getBaseCR();
396 member.getRepairTracker().applyCREvent(max - curr,
"Repaired at dockyard");
399 }
else if (action.equals(
"printRefitHint")) {
402 String transponder =
"";
404 transponder =
"\n\nAlso: you'll need to re-dock with your transponder turned on to take advantage of Ancyra's facilities.";
406 dialog.
getTextPanel().
addPara(
"(Once this conversation is over, press %s to open the refit screen. " +
407 "After selecting a specific ship, you can press %s to %s - pick a desired loadout, " +
408 "and the ship will be automatically refitted to match it, using what weapons are available." +
412 dialog.
getTextPanel().
addPara(
"In addition, you now have access to local storage at Ancyra, " +
413 "and some weapons and supplies have been placed there. To access it, click on the " +
414 "\"Storage\" button in the trade screen.)",
471 for (
int i = 0; i < 20; i++) {
525 for (
WeaponSlotAPI slot : member.getVariant().getHullSpec().getAllWeaponSlotsCopy()) {
528 if (weaponId !=
null) {
550 case LARGE:
return pick(
"mark9",
"hephag",
"hellbore");
551 case MEDIUM:
return pick(
"arbalest",
"heavymortar",
"shredder");
552 case SMALL:
return pick(
"lightmg",
"lightac",
"lightmortar");
558 case LARGE:
return pick(
"hammerrack");
559 case MEDIUM:
return pick(
"pilum",
"annihilatorpod");
560 case SMALL:
return pick(
"harpoon",
"sabot",
"annihilator");
565 case LARGE:
return pick(
"autopulse",
"hil");
566 case MEDIUM:
return pick(
"miningblaster",
"gravitonbeam",
"pulselaser");
567 case SMALL:
return pick(
"mininglaser",
"taclaser",
"pdlaser",
"ioncannon");
576 public String
pick(String ...strings) {
577 return strings[
new Random().nextInt(strings.length)];
604 if (mode == ListInfoMode.IN_DESC) pad = 10f;
622 info.
addPara(
"Retrieve AI core from derelict probe beyond the orbit of Pontus", tc, pad);
627 case GO_RECOVER_SHIPS:
628 info.
addPara(
"Recover at least %s ships at Tetra", pad, tc, h,
"" + 2);
630 case RECOVERED_SHIPS:
634 info.
addPara(
"Stabilize the inner-system jump-point", tc, pad);
637 info.
addPara(
"Return to Ancyra and report your success", tc, pad);
643 info.
addPara(
"Completed", tc, pad);
651 return "Stabilize the Jump-points";
680 boolean addedBullets =
false;
683 info.
addPara(
"You receive a tight-beam communication from the system's main inhabited world, Ancyra.", opad);
685 info.
addPara(
"The message is brief and asks you to travel there and contact " +
690 "to acquire the raw jump-point readings.", opad);
692 info.
addPara(
"Contact must be made with the transponder off as the miners of Derinkuyu have " +
693 "turned pirate and your fleet will be attacked otherwise.", opad);
698 info.
addPara(
"Use %s to avoid detection, and %s to get away if you are seen.", opad, h,
699 "Go Dark",
"Emergency Burn");
703 " to deliver the jump-point data.", opad);
706 info.
addPara(
"Analyzing the jump-point data requires an AI Core.", opad);
708 info.
addPara(
"There's a Domain-era survey probe outside the orbit of Pontus. If salvaged, " +
709 "it's likely to yield a gamma AI core, which should be sufficient for the task.", opad);
711 info.
addPara(
"Go to Pontus, head out towards the asteroid belt, and then use an " +
712 "%s to locate the probe. ", opad, h,
"Active Sensor Burst");
714 info.
addPara(
"Approach the probe and salvage it to recover the gamma core.", opad);
716 info.
addPara(
"It's likely that you will have to overcome some automated defenses first.", opad);
720 " to deliver the AI core.", opad);
722 case GO_RECOVER_SHIPS:
723 info.
addPara(
"Go to the ship graveyard around Tetra and recover as many ships as possible.", opad);
725 info.
addPara(
"Bring extra crew to man the recovered ships, and extra supplies to " +
726 " help restore their combat readiness.", opad);
728 case RECOVERED_SHIPS:
730 " at Ancyra for help with outfitting the recovered ships with weapons.", opad);
733 info.
addPara(
"Use the hyperwave sequence produced by the AI core " +
734 "to stabilize the inner-system jump-point.", opad);
736 info.
addPara(
"You will have to defeat the pirates guarding it first.", opad);
739 info.
addPara(
"Galatia's connection with hyperspace has been restored, " +
740 "and trade fleets are once again able to enter and leave the system.", opad);
742 info.
addPara(
"The Derinkuyu leadership will surely soon be toppled by rank-and-file " +
743 "miners eager to get on the right side of the law once again.", opad);
749 info.
addPara(
"Make sure you have enough fuel to make the trip successfully.", opad);
752 info.
addPara(
"You have delivered the report and " +
753 "your standing with the Hegemony has increased substantially.", opad);
755 info.
addPara(
"Galatia's connection with hyperspace has been restored, " +
756 "and trade fleets are once again able to enter and leave the system.", opad);
772 Set<String> tags = super.getIntelTags(map);
792 case GOT_DATA:
return ancyra;
793 case GO_GET_AI_CORE:
return pontus;
794 case GOT_AI_CORE:
return ancyra;
795 case GO_RECOVER_SHIPS:
return tetra;
796 case RECOVERED_SHIPS:
return ancyra;
797 case GO_STABILIZE:
return inner;
798 case STABILIZED:
return ancyra;
799 case DELIVER_REPORT:
return jangala;
815 return IntelSortTier.TIER_2;
static SettingsAPI getSettings()
static FactoryAPI getFactory()
static SectorAPI getSector()
void unmodifyMult(String source)
static final String CAN_STABILIZE
static final String UNSTABLE_KEY
static final String SENSOR_BURST
static final String SUSTAINED_BURN
static final String SCAVENGE
static final String TRANSPONDER
static final String GO_DARK
static final String INTERDICTION_PULSE
static final String EMERGENCY_BURN
static final String DISTRESS_CALL
static final String GAMMA_CORE
static final String WRECK
static final String HEGEMONY
static final String PIRATES
static final String INDEPENDENT
static final String MARKET_DO_NOT_INIT_COMM_LISTINGS
static final String OBJECTIVE_NON_FUNCTIONAL
static final String MEMORY_KEY_PATROL_ALLOW_TOFF
static String POST_STATION_COMMANDER
static final String PATROL_NUM_MEDIUM_MOD
static final String PATROL_NUM_LIGHT_MOD
static final String PATROL_NUM_HEAVY_MOD
static final String SUBMARKET_STORAGE
void addActive(EveryFrameScript event)
boolean isSendingUpdate()
void unindent(TooltipMakerAPI info)
static String getSoundStandardUpdate()
void sendUpdateIfPlayerHasIntel(Object listInfoParam, TextPanelAPI textPanel)
Color getBulletColorForMode(ListInfoMode mode)
void setImportant(Boolean important)
void bullet(TooltipMakerAPI info)
static String getSoundMajorPosting()
Color getTitleColor(ListInfoMode mode)
boolean isActive(MarketAPI market)
static SystemBountyManager getInstance()
void addOrResetBounty(MarketAPI market)
static void addFleetMemberGainText(FleetMemberAPI member, TextPanelAPI text)
void setPlayerPaidToUnlock(boolean playerPaidToUnlock)
static final String USE_TUTORIAL_RESPAWN
void advance(float amount)
static final String REASON
void advanceImpl(float amount)
static boolean isTutorialInProgress()
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
String getMainContactPostName()
String getJangalaContactPostName()
void updateStage(TutorialMissionStage stage, TextPanelAPI text)
String getCommMessageSound()
PersonAPI getMainContact()
static final String TUT_STAGE
SectorEntityToken detachment
void createSmallDescription(TooltipMakerAPI info, float width, float height)
static void endGalatiaPortionOfMission(boolean withStipend, boolean didTutorial)
String pick(String ...strings)
IntelSortTier getSortTier()
SectorEntityToken derinkuyu
Set< String > getIntelTags(SectorMapAPI map)
static PersonAPI getJangalaContact()
String getSmallDescriptionTitle()
static PersonAPI createMainContact(PlanetAPI ancyra)
TutorialMissionStage stage
SectorEntityToken getMapLocation(SectorMapAPI map)
boolean callEvent(String ruleId, final InteractionDialogAPI dialog, List< Token > params, Map< String, MemoryAPI > memoryMap)
String getWeaponForSlot(WeaponSlotAPI slot)
void addWeaponsToStorage()
boolean canTurnImportantOff()
FactionAPI getFactionForUIColors()
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
static Color getTextColor()
static float getDistanceLY(SectorEntityToken from, SectorEntityToken to)
static String ucFirst(String str)
static void makeImportant(SectorEntityToken entity, String reason)
static Color getGrayColor()
static void cleanUpMissionMemory(MemoryAPI memory, String prefix)
static float getDistance(SectorEntityToken from, SectorEntityToken to)
static void makeUnimportant(SectorEntityToken entity, String reason)
static Color getHighlightColor()
FleetMemberAPI createFleetMember(FleetMemberType type, String variantOrWingId)
String getSpriteName(String category, String id)
String getControlStringForEnumName(String name)
float convertToDays(float realSeconds)
FleetDataAPI getFleetData()
FleetLogisticsAPI getLogistics()
HintPanelAPI getHintPanel()
void addWeapons(String id, int count)
float getCommodityQuantity(String id)
void addSupplies(float quantity)
void addFighters(String id, int count)
void addAbility(String id)
List< CommDirectoryEntryAPI > getEntriesCopy()
String addPerson(PersonAPI person)
RelationshipAPI getRelToPlayer()
PersonAPI createRandomPerson()
void addFleetMember(FleetMemberAPI member)
List< FleetMemberAPI > getMembersListCopy()
TextPanelAPI getTextPanel()
SectorEntityToken getEntityById(String id)
void removeTag(String tag)
List< SectorEntityToken > getEntitiesWithTag(String tag)
void addScript(EveryFrameScript script)
List< CampaignFleetAPI > getFleets()
CampaignFleetAPI getPlayerFleet()
void addScript(EveryFrameScript script)
boolean hasScript(Class<?> clazz)
CampaignClockAPI getClock()
void removeScript(EveryFrameScript script)
IntelManagerAPI getIntelManager()
CampaignUIAPI getCampaignUI()
FactionAPI getFaction(String factionId)
StarSystemAPI getStarSystem(String name)
MemoryAPI getMemoryWithoutUpdate()
CharacterDataAPI getCharacterData()
Vector2f getLocationInHyperspace()
MemoryAPI getMemoryWithoutUpdate()
boolean isTransponderOn()
LabelAPI addPara(String text)
void addIntel(IntelInfoPlugin plugin)
MarketAPI getMarket(String id)
void addMarket(MarketAPI market, boolean withJunkAndChatter)
void setEconGroup(String econGroup)
MutableMarketStatsAPI getStats()
MemoryAPI getMemoryWithoutUpdate()
void addPerson(PersonAPI person)
CommDirectoryAPI getCommDirectory()
float getExpire(String key)
boolean contains(String key)
void set(String key, Object value)
void setRankId(String rank)
MemoryAPI getMemoryWithoutUpdate()
void setPostId(String postId)
float getFuelCostPerLightYear()
DynamicStatsAPI getDynamic()
WeaponAPI.WeaponSize getSlotSize()
WeaponAPI.WeaponType getWeaponType()
void clearHints(boolean withFade)
StatBonus getMod(String id)