1package com.fs.starfarer.api.impl.campaign.intel.misc;
6import org.lwjgl.input.Keyboard;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.CustomCampaignEntityPlugin;
10import com.fs.starfarer.api.campaign.FactionAPI;
11import com.fs.starfarer.api.campaign.SectorEntityToken;
12import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
13import com.fs.starfarer.api.impl.campaign.CampaignObjective;
14import com.fs.starfarer.api.impl.campaign.CommRelayEntityPlugin;
15import com.fs.starfarer.api.impl.campaign.ids.Tags;
16import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
17import com.fs.starfarer.api.ui.ButtonAPI;
18import com.fs.starfarer.api.ui.IntelUIAPI;
19import com.fs.starfarer.api.ui.LabelAPI;
20import com.fs.starfarer.api.ui.SectorMapAPI;
21import com.fs.starfarer.api.ui.TooltipMakerAPI;
22import com.fs.starfarer.api.util.IntervalUtil;
23import com.fs.starfarer.api.util.Misc;
29 protected SectorEntityToken
relay;
30 protected IntervalUtil
check =
new IntervalUtil(30f * 0.5f, 30f * 1.5f);
54 CustomCampaignEntityPlugin plugin =
relay.getCustomPlugin();
64 super.advanceImpl(amount);
66 float days = Misc.getDays(amount);
69 if (
check.intervalElapsed()) {
71 if ((
float) Math.random() < p) {
91 Color h = Misc.getHighlightColor();
92 Color g = Misc.getGrayColor();
97 if (mode == ListInfoMode.IN_DESC) initPad = opad;
125 if (curr <= max)
return 0f;
135 info.addPara(
getName(), c, 0f);
141 Color h = Misc.getHighlightColor();
142 Color g = Misc.getGrayColor();
143 Color tc = Misc.getTextColor();
147 info.addImage(
Global.
getSector().getPlayerFaction().getLogo(), width, 128, opad);
149 String name =
relay.getName();
150 if (name.equals(
relay.getCustomEntitySpec().getDefaultName())) {
151 name = name.toLowerCase();
157 info.addPara(
"You've uninstalled the comm sniffer at " + name +
".", opad);
159 info.addPara(
"The comm sniffer installed at " + name +
" is no longer responding to status queries.", opad);
163 info.addPara(
"You have installed a comm sniffer at " + name +
".", opad);
164 if (!
relay.isInHyperspace()) {
165 info.addPara(
"It is providing you with up-to-date local intel for the " +
166 relay.getContainingLocation().getNameWithLowercaseType() +
".", opad);
173 String danger =
null;
174 Color dangerColor =
null;
178 }
else if (p <= 0.33f) {
180 dangerColor = Misc.getPositiveHighlightColor();
181 }
else if (p <= 0.67f) {
186 dangerColor = Misc.getNegativeHighlightColor();
196 String sniffers =
"sniffers";
197 String any =
"any of them";
199 sniffers =
"sniffer";
202 if (danger ==
null) {
203 info.addPara(
"You have %s comm " + sniffers +
" installed in the comm network. " +
204 "There is no danger of " + any +
" being detected and cleared out.", opad,
207 LabelAPI label = info.addPara(
"You have %s comm " + sniffers +
" installed in the comm network. The probability " +
208 "of " + any +
" being detected and cleared out is %s.", opad,
209 h,
"" + num, danger);
210 label.setHighlight(
"" + num, danger);
211 label.setHighlightColors(h, dangerColor);
216 button.setShortcut(Keyboard.KEY_U,
true);
234 ui.recreateIntelUI();
241 prompt.addPara(
"Uninstalling this comm sniffer will reduce the chance " +
242 "that the remaining comm sniffers are detected.", 0f);
259 Set<String> tags = super.getIntelTags(map);
260 tags.add(Tags.INTEL_COMM_SNIFFERS);
265 return "Comm Sniffer";
269 String base =
"Comm Sniffer";
272 return base +
" - Uninstalled";
274 return base +
" - Lost";
277 return base +
" Installed";
285 return super.getFactionForUIColors();
static SettingsAPI getSettings()
static SectorAPI getSector()
void unindent(TooltipMakerAPI info)
ButtonAPI addGenericButton(TooltipMakerAPI info, float width, String text, Object data)
static String getSoundMinorMessage()
void sendUpdateIfPlayerHasIntel(Object listInfoParam, TextPanelAPI textPanel)
Object getListInfoParam()
Color getBulletColorForMode(ListInfoMode mode)
void bullet(TooltipMakerAPI info)
Color getTitleColor(ListInfoMode mode)
static CommSnifferIntel getExistingSnifferIntelForRelay(SectorEntityToken relay)
SectorEntityToken getMapLocation(SectorMapAPI map)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
String getSmallDescriptionTitle()
boolean doesButtonHaveConfirmDialog(Object buttonId)
FactionAPI getFactionForUIColors()
void createSmallDescription(TooltipMakerAPI info, float width, float height)
Set< String > getIntelTags(SectorMapAPI map)
void createConfirmationPrompt(Object buttonId, TooltipMakerAPI prompt)
void advanceImpl(float amount)
String getCommMessageSound()
CommSnifferIntel(SectorEntityToken relay)
static final String UNINSTALL
SectorEntityToken getRelay()
void buttonPressConfirmed(Object buttonId, IntelUIAPI ui)
boolean shouldRemoveIntel()
String getSpriteName(String category, String id)
float getFloat(String key)
void setHacked(boolean hacked)