001package com.fs.starfarer.api.impl.campaign.intel.misc; 002 003import java.awt.Color; 004 005import com.fs.starfarer.api.Global; 006import com.fs.starfarer.api.campaign.StarSystemAPI; 007import com.fs.starfarer.api.ui.TooltipMakerAPI; 008import com.fs.starfarer.api.util.Misc; 009 010public class DistressCallIntel extends BreadcrumbIntelV2 { 011 012 protected StarSystemAPI system; 013 014 public DistressCallIntel(StarSystemAPI system) { 015 super(system.getCenter()); 016 this.system = system; 017 Global.getSector().addScript(this); 018 019 //setIcon(Global.getSettings().getSpriteName("intel", "distress_call")); 020 setIconId("distress_call"); 021 setSound("ui_intel_distress_call"); 022 setDuration(60f); 023 setTitle("Distress Call"); 024 setText("You receive a distress call from the nearby " + system.getNameWithLowercaseType() + ". " + 025 "There's no additional information, but that's not surprising - " + 026 "a typical fleet doesn't carry the equipment to broadcast a full-fledged data " + 027 "stream into hyperspace."); 028 } 029 030 @Override 031 public void advance(float amount) { 032 super.advance(amount); 033 if (system == Global.getSector().getCurrentLocation()) { 034 endAfterDelay(); 035 } 036 } 037 038 039 040 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) { 041 Color c = getTitleColor(mode); 042 info.addPara(getName(), c, 0f); 043 044 float pad = 3f; 045 float opad = 10f; 046 047 float initPad = pad; 048 if (mode == ListInfoMode.IN_DESC) initPad = opad; 049 050 Color tc = getBulletColorForMode(mode); 051 if (system != null) { 052 bullet(info); 053 info.addPara("Originating in the " + system.getNameWithLowercaseType() + "", tc, initPad); 054 unindent(info); 055 } 056 } 057 058 @Override 059 public void createSmallDescription(TooltipMakerAPI info, float width, float height) { 060 Color h = Misc.getHighlightColor(); 061 Color g = Misc.getGrayColor(); 062 Color tc = Misc.getTextColor(); 063 float pad = 3f; 064 float opad = 10f; 065 066 info.addPara(text, opad); 067 068// float days = getDaysSincePlayerVisible(); 069// if (days >= 1) { 070// addDays(info, "ago.", days, tc, opad); 071// } 072 073 if (isEnding()) { 074 info.addPara("You've investigated the system this distress call came from.", opad); 075 } 076 077 addLogTimestamp(info, tc, opad); 078 079 addDeleteButton(info, width); 080 } 081 082 public String getSortString() { 083 //return "Distress Call"; 084 return super.getSortString(); 085 } 086 087 public String getName() { 088 if (isEnding()) return title + " - Investigated"; 089 return title; 090 } 091 092 @Override 093 public boolean shouldRemoveIntel() { 094 if (isEnded()) return true; 095 return super.shouldRemoveIntel(); 096 } 097 098 099}