1package com.fs.starfarer.api.impl.campaign.intel.bar.events.historian;
3import java.util.LinkedHashMap;
6import java.util.Random;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.InteractionDialogAPI;
10import com.fs.starfarer.api.campaign.TextPanelAPI;
11import com.fs.starfarer.api.campaign.econ.MarketAPI;
12import com.fs.starfarer.api.campaign.rules.MemKeys;
13import com.fs.starfarer.api.campaign.rules.MemoryAPI;
14import com.fs.starfarer.api.impl.campaign.intel.bar.events.BarEventManager;
15import com.fs.starfarer.api.impl.campaign.intel.bar.events.BaseBarEvent;
16import com.fs.starfarer.api.impl.campaign.intel.bar.events.historian.HistorianData.HistorianOffer;
17import com.fs.starfarer.api.impl.campaign.plog.PLIntel;
18import com.fs.starfarer.api.impl.campaign.plog.PlaythroughLog;
19import com.fs.starfarer.api.impl.campaign.rulecmd.FireBest;
20import com.fs.starfarer.api.impl.campaign.shared.SharedData;
21import com.fs.starfarer.api.util.Misc;
25 public static enum OptionId {
28 GREETNG_ALREADY_INTRODUCED,
45 protected transient List<HistorianOffer>
offers =
null;
56 return super.shouldShowAtMarket(
market);
85 return "Go over to the " + hd.
getManOrWoman() +
" with the paper book and see what " + hd.
getHeOrShe() +
" wants";
90 return "An old " + hd.
getManOrWoman() +
" sits alone at a table, " +
91 "leafing through what looks like a genuine hardcopy paper book. As you walk by, " +
105 this.memoryMap =
new LinkedHashMap<String, MemoryAPI>(
memoryMap);
121 if (!hasLog && shouldShow) {
136 if (optionData == OptionId.GREETNG_PLOG) {
137 text.
addPara(
"\"Welcome! I've got something here that I think you'll find very interesting. Your actions over " +
138 "the past several cycles have caused quite a stir in certain corners, and I took it upon myself to " +
139 "look into your history, as it were. Here, let me transfer the synopsis.\"");
140 text.
addPara(
"Your TriPad chimes softly; a new program is ready to be installed.");
144 options.
addOption(
"\"Thank you! This is fascinating and not at all alarming. Now, what do you have for me?\"", OptionId.WHAT_DO_YOU_HAVE);
156 if (optionData == OptionId.GREETING) {
157 text.
addPara(
"\"Welcome, welcome, please sit! I'm sure you're wondering why I called you over.\"\n\n" +
159 "I think we can help each other, you and I. See, I have the information,\" " +
160 hd.
getHeOrShe() +
" taps the book, "+
"\"And you have the means.\"");
161 text.
addPara(
"\"I am what you might call a historian-adventurer; a rogue archaelogist uncovering the " +
162 "history of the Sector despite the danger of this exceptional era. In the course of my "
163 +
"studies I often chance upon hints about where certain " +
164 "pieces of technology might be found. Retrieving those artifacts " +
165 "is, naturally, your role in our arrangement. ... Only if you're interested,"
166 +
" of course - but I've done my research " +
167 "on your exploits and I'm sure that you will be interested.\"\n\nSpeech complete, " + hd.
getHeOrShe() +
168 " leans back, looking pleased.");
171 options.
addOption(
"\"I expect you'll be wanting to get paid for this information?\"", OptionId.GREETNG_CONTINUE_1);
175 if (optionData == OptionId.GREETNG_CONTINUE_1) {
177 " resumes an energetic demeanor.");
178 text.
addPara(
"\"I understand why you would assume that; this is a mercenary age. " +
179 "But no, nothing quite so transactional. " +
180 "History is an uncertain trade, and such an approach " +
181 "would lead to expectations, disappointment, and recrimination. All of which I'm eager to avoid, " +
182 "especially the last.\" An additional wrinkle forms on " + hd.
getHisOrHer()+
" face at this.");
183 text.
addPara(
"\"However, if you did find my information valuable, I would gladly accept... donations. Think of it as patronage to " +
184 "fuel my research, which in turn could produce valuable leads. Or it " +
185 "might help to think of it as an investment, but with no obligations incurred " +
186 "by either party. Consider it- you could enrich your own enterprises while contributing to" +
187 " the sum of human knowledge!\"");
192 options.
addOption(
"\"Do you have anything for me now?\"", OptionId.WHAT_DO_YOU_HAVE);
196 if (optionData == OptionId.GREETNG_ALREADY_INTRODUCED) {
198 text.
addPara(
"You spend a couple minutes sharing drinks and conversing about " +
199 "recent goings-on in the Sector. Before long you get down to business.");
204 if (optionData == OptionId.WHAT_DO_YOU_HAVE) {
220 for (HistorianOffer offer :
offers) {
221 offer.addPromptAndOption(
dialog);
225 options.
addOption(
"... something interesting, but not of immediate import", OptionId.BACKSTORY_BIT);
229 boolean forceEnd =
false;
230 if (optionData == OptionId.BACKSTORY_BIT) {
253 if (optionData == OptionId.END_CONVERSATION || forceEnd) {
255 text.
addPara(
"\"See you again soon, somewhere!\" " + hd.
getHeOrShe() +
" says. \"In my line of work, even I don't " +
256 "know for sure where I'll end up in a couple of months.\"");
266 boolean initedOffer =
false;
267 if (optionData instanceof HistorianOffer) {
static SectorAPI getSector()
static final String PERSON_FACTION
static final String LOCAL
static final String ENTITY
void notifyWasInteractedWith(PortsideBarEvent event)
static BarEventManager getInstance()
transient TextPanelAPI text
transient OptionPanelAPI options
transient Map< String, MemoryAPI > memoryMap
transient InteractionDialogAPI dialog
static int MIN_SNAPSHOTS_TO_SHOW_PLOG
void optionSelected(String optionText, Object optionData)
void addPromptAndOption(InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
transient HistorianOffer currentOffer
boolean shouldShowAtMarket(MarketAPI market)
void regen(MarketAPI market)
void init(InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap)
static float PROB_TO_SHOW
transient List< HistorianOffer > offers
List< HistorianOffer > getOffers(Random random, InteractionDialogAPI dialog)
void setRecentlyDonated()
static HistorianData getInstance()
void setIntroduced(boolean introduced)
List< PLSnapshot > getData()
static PlaythroughLog getInstance()
static boolean fire(String ruleId, InteractionDialogAPI dialog, Map< String, MemoryAPI > memoryMap, String params)
UniqueEncounterData getUniqueEncounterData()
static SharedData getData()
static Random getRandom(long seed, int level)
TextPanelAPI getTextPanel()
VisualPanelAPI getVisualPanel()
SectorEntityToken getInteractionTarget()
OptionPanelAPI getOptionPanel()
void addOption(String text, Object data)
IntelManagerAPI getIntelManager()
PersonAPI getPlayerPerson()
void setActivePerson(PersonAPI activePerson)
LabelAPI addPara(String text)
void showPersonInfo(PersonAPI person)
void addIntel(IntelInfoPlugin plugin)
boolean hasIntelOfClass(Class<?> c)
void setRandomForNextRulePick(Random random)