Starsector API
Loading...
Searching...
No Matches
DecivIntel.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.deciv;
2
3import java.awt.Color;
4import java.util.Set;
5
6import com.fs.starfarer.api.Global;
7import com.fs.starfarer.api.campaign.FactionAPI;
8import com.fs.starfarer.api.campaign.SectorEntityToken;
9import com.fs.starfarer.api.campaign.econ.MarketAPI;
10import com.fs.starfarer.api.impl.campaign.ids.Tags;
11import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
12import com.fs.starfarer.api.ui.SectorMapAPI;
13import com.fs.starfarer.api.ui.TooltipMakerAPI;
14import com.fs.starfarer.api.util.Misc;
15
16public class DecivIntel extends BaseIntelPlugin {
17
18 //protected MarketAPI market;
19 protected SectorEntityToken primary;
20 protected String name;
21 protected FactionAPI faction;
22 protected boolean destroyed;
23 protected boolean warning;
24
25 public DecivIntel(MarketAPI market, SectorEntityToken primary, boolean destroyed, boolean warning) {
26 //this.market = market;
27 this.primary = primary;
28 this.destroyed = destroyed;
29 this.warning = warning;
30 this.faction = market.getFaction();
31 name = market.getName();
32 }
33
34 protected void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode) {
35
36 Color h = Misc.getHighlightColor();
37 Color g = Misc.getGrayColor();
38 float pad = 3f;
39 float opad = 10f;
40
41 float initPad = pad;
42 if (mode == ListInfoMode.IN_DESC) initPad = opad;
43
44 Color tc = getBulletColorForMode(mode);
45
46 bullet(info);
47 boolean isUpdate = getListInfoParam() != null;
48
49// info.addPara("Danger level: " + danger, initPad, tc, dangerColor, danger);
50// initPad = 0f;
51
52 unindent(info);
53 }
54
55
56 @Override
57 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) {
58 Color c = getTitleColor(mode);
59 info.addPara(getName(), c, 0f);
60 addBulletPoints(info, mode);
61 }
62
63 @Override
64 public void createSmallDescription(TooltipMakerAPI info, float width, float height) {
65 Color h = Misc.getHighlightColor();
66 Color g = Misc.getGrayColor();
67 Color tc = Misc.getTextColor();
68 float pad = 3f;
69 float opad = 10f;
70
71
72 info.addImage(getFactionForUIColors().getLogo(), width, 128, opad);
73
74 if (warning) {
75 info.addPara("Conditions at " + name + ", a colony belonging to " +
76 faction.getDisplayNameWithArticle() + ", have taken a turn for the worse. Unless the colony " +
77 "is stabilized in some way, it's likely to decivilize and be lost completely in the near future.",
78 opad, faction.getBaseUIColor(), faction.getDisplayNameWithArticleWithoutArticle());
79 } else if (destroyed) {
80 info.addPara(name + ", a colony formerly belonging to " +
81 faction.getDisplayNameWithArticle() + ", has been destroyed.",
82 opad, faction.getBaseUIColor(), faction.getDisplayNameWithArticleWithoutArticle());
83 } else {
84 info.addPara(name + ", a colony formerly belonging to " +
85 faction.getDisplayNameWithArticle() + ", has become decivilized. " +
86 "Central authority has collapsed completely and irreversibly, with the remaining " +
87 "population scrambling to survive.",
88 opad, faction.getBaseUIColor(), faction.getDisplayNameWithArticleWithoutArticle());
89 }
90
91 addBulletPoints(info, ListInfoMode.IN_DESC);
92 }
93
94 @Override
95 public String getIcon() {
96 return Global.getSettings().getSpriteName("intel", "deciv");
97 }
98
99 @Override
100 public Set<String> getIntelTags(SectorMapAPI map) {
101 Set<String> tags = super.getIntelTags(map);
102 tags.add(Tags.INTEL_DECIVILIZED);
103 return tags;
104 }
105
106 public String getSortString() {
107 return "Decivilized " + name;
108 }
109
110 public String getName() {
111 if (warning) {
112 return name + " - Deterioration";
113 }
114 if (destroyed) {
115 return name + " - Destroyed";
116 }
117 return name + " - Decivilized";
118 }
119
120 @Override
121 public FactionAPI getFactionForUIColors() {
122 return faction;
123 }
124
125 public String getSmallDescriptionTitle() {
126 return getName();
127 }
128
129 @Override
130 public SectorEntityToken getMapLocation(SectorMapAPI map) {
131 return primary;
132 }
133
134 @Override
135 public boolean shouldRemoveIntel() {
136 return false;
137 }
138
139 @Override
140 public String getCommMessageSound() {
141 return super.getCommMessageSound();
142 }
143
144
145
146}
147
148
149
150
151
152
153
static SettingsAPI getSettings()
Definition Global.java:51
SectorEntityToken getMapLocation(SectorMapAPI map)
void createSmallDescription(TooltipMakerAPI info, float width, float height)
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
DecivIntel(MarketAPI market, SectorEntityToken primary, boolean destroyed, boolean warning)
String getSpriteName(String category, String id)