Starsector API
Loading...
Searching...
No Matches
BreadcrumbIntel.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.misc;
2
3import java.awt.Color;
4import java.util.ArrayList;
5import java.util.List;
6import java.util.Set;
7
8import com.fs.starfarer.api.campaign.FactionAPI;
9import com.fs.starfarer.api.campaign.SectorEntityToken;
10import com.fs.starfarer.api.impl.campaign.ids.Tags;
11import com.fs.starfarer.api.ui.SectorMapAPI;
12import com.fs.starfarer.api.ui.TooltipMakerAPI;
13import com.fs.starfarer.api.util.Misc;
14
15public class BreadcrumbIntel extends FleetLogIntel {
16
17 protected SectorEntityToken foundAt;
18 protected SectorEntityToken target;
19
20 protected String title;
21 protected String text;
22
23 protected Boolean showSpecificEntity = null;
24
25 public BreadcrumbIntel(SectorEntityToken foundAt, SectorEntityToken target) {
26 if (foundAt != null) {
27 this.foundAt = makeDoubleWithSameOrbit(foundAt);
28 }
29 this.target = makeDoubleWithSameOrbit(target);
30 target.getContainingLocation().addEntity(target);
32
33// String targetName = BreadcrumbSpecial.getNameWithAOrAn(target, null, true);
34// String targetNameUC = BreadcrumbSpecial.getNameWithAOrAn(target, null, false);
35// //String entityName = getNameWithAOrAn(entity, null);
36// String located = BreadcrumbSpecial.getLocatedString(target);
37//
38// String subject = "Location: " + Misc.ucFirst(targetNameUC.substring(targetNameUC.indexOf(" ") + 1)) + "");
39// String text1ForIntel = Misc.getStringWithTokenReplacement("While exploring $aOrAn $nameInText, " +
40// "your crews found a partially accessible memory bank " +
41// "containing information that indicates " + targetName + " is " + located + ".",
42// foundAt, null);
43 }
44
45 @Override
46 public void reportRemovedIntel() {
47 super.reportRemovedIntel();
48 target.getContainingLocation().removeEntity(target);
49 }
50
51
52
53 public static SectorEntityToken makeDoubleWithSameOrbit(SectorEntityToken entity) {
54 SectorEntityToken copy = entity.getContainingLocation().createToken(entity.getLocation().x, entity.getLocation().y);
55 if (entity.getOrbit() != null) {
56 copy.setOrbit(entity.getOrbit().makeCopy());
57 }
58 return copy;
59 }
60
61
62 public String getTitle() {
63 return title;
64 }
65
66 public void setTitle(String title) {
67 this.title = title;
68 }
69
70 public String getText() {
71 return text;
72 }
73
74 public void setText(String text) {
75 this.text = text;
76 }
77
78 @Override
79 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) {
80 Color c = getTitleColor(mode);
81 info.addPara(getName(), c, 0f);
82 }
83
84 @Override
85 public void createSmallDescription(TooltipMakerAPI info, float width, float height) {
86 Color h = Misc.getHighlightColor();
87 Color g = Misc.getGrayColor();
88 Color tc = Misc.getTextColor();
89 float pad = 3f;
90 float opad = 10f;
91
92 info.addPara(text, opad);
93
94 //target.getOrbit().updateLocation();
95
96 float days = getDaysSincePlayerVisible();
97 if (days >= 1) {
98 addDays(info, "ago.", days, tc, opad);
99 }
100
101 addDeleteButton(info, width);
102 }
103
104 @Override
105 public String getIcon() {
106 return super.getIcon();
107 }
108
109 @Override
110 public Set<String> getIntelTags(SectorMapAPI map) {
111 Set<String> tags = super.getIntelTags(map);
112 tags.add(Tags.INTEL_EXPLORATION);
113 return tags;
114 }
115
116 public String getSortString() {
117 return "Location";
118 }
119
120 public String getName() {
121 return title;
122 }
123
124 @Override
125 public FactionAPI getFactionForUIColors() {
126 return super.getFactionForUIColors();
127 }
128
129 public String getSmallDescriptionTitle() {
130 return getName();
131 }
132
133 @Override
134 public SectorEntityToken getMapLocation(SectorMapAPI map) {
135 if (target.getStarSystem() != null && showSpecificEntity == null) {
136 return target.getStarSystem().getCenter();
137 }
138 return target;
139 }
140
141 @Override
142 public boolean shouldRemoveIntel() {
143 return super.shouldRemoveIntel();
144 }
145
146 @Override
147 public String getCommMessageSound() {
148 if (sound != null) return sound;
149 return getSoundMinorMessage();
150 }
151
152 public Boolean getShowSpecificEntity() {
153 return showSpecificEntity;
154 }
155
156 public void setShowSpecificEntity(Boolean showPlanet) {
157 if (showPlanet != null && !showPlanet) showPlanet = null;
158
159 this.showSpecificEntity = showPlanet;
160 }
161
162 public List<ArrowData> getArrowData(SectorMapAPI map) {
163 if (foundAt == null) return null;
164
165 List<ArrowData> result = new ArrayList<ArrowData>();
166
167 if (foundAt.getContainingLocation() == target.getContainingLocation() &&
168 foundAt.getContainingLocation() != null &&
169 !foundAt.getContainingLocation().isHyperspace()) {
170 return null;
171 }
172
173// SectorEntityToken entityFrom = foundLocation;
174// if (map != null) {
175// SectorEntityToken iconEntity = map.getIntelIconEntity(this);
176// if (iconEntity != null) {
177// entityFrom = iconEntity;
178// }
179// }
180//
181// ArrowData arrow = new ArrowData(entityFrom, targetLocation);
182 ArrowData arrow = new ArrowData(foundAt, target);
183
184 arrow.color = getFactionForUIColors().getBaseUIColor();
185 result.add(arrow);
186
187 return result;
188 }
189
190
191
192
193}
void addDays(TooltipMakerAPI info, String after, float days)
void addDeleteButton(TooltipMakerAPI info, float width)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
static SectorEntityToken makeDoubleWithSameOrbit(SectorEntityToken entity)
BreadcrumbIntel(SectorEntityToken foundAt, SectorEntityToken target)
void createSmallDescription(TooltipMakerAPI info, float width, float height)
void setRemoveTrigger(SectorEntityToken removeTrigger)