001package com.fs.starfarer.api.impl.campaign.intel.deciv; 002 003import java.awt.Color; 004import java.util.Set; 005 006import com.fs.starfarer.api.Global; 007import com.fs.starfarer.api.campaign.FactionAPI; 008import com.fs.starfarer.api.campaign.SectorEntityToken; 009import com.fs.starfarer.api.campaign.econ.MarketAPI; 010import com.fs.starfarer.api.impl.campaign.ids.Tags; 011import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin; 012import com.fs.starfarer.api.ui.SectorMapAPI; 013import com.fs.starfarer.api.ui.TooltipMakerAPI; 014import com.fs.starfarer.api.util.Misc; 015 016public class DecivIntel extends BaseIntelPlugin { 017 018 //protected MarketAPI market; 019 protected SectorEntityToken primary; 020 protected String name; 021 protected FactionAPI faction; 022 protected boolean destroyed; 023 protected boolean warning; 024 025 public DecivIntel(MarketAPI market, SectorEntityToken primary, boolean destroyed, boolean warning) { 026 //this.market = market; 027 this.primary = primary; 028 this.destroyed = destroyed; 029 this.warning = warning; 030 this.faction = market.getFaction(); 031 name = market.getName(); 032 } 033 034 protected void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode) { 035 036 Color h = Misc.getHighlightColor(); 037 Color g = Misc.getGrayColor(); 038 float pad = 3f; 039 float opad = 10f; 040 041 float initPad = pad; 042 if (mode == ListInfoMode.IN_DESC) initPad = opad; 043 044 Color tc = getBulletColorForMode(mode); 045 046 bullet(info); 047 boolean isUpdate = getListInfoParam() != null; 048 049// info.addPara("Danger level: " + danger, initPad, tc, dangerColor, danger); 050// initPad = 0f; 051 052 unindent(info); 053 } 054 055 056 @Override 057 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) { 058 Color c = getTitleColor(mode); 059 info.addPara(getName(), c, 0f); 060 addBulletPoints(info, mode); 061 } 062 063 @Override 064 public void createSmallDescription(TooltipMakerAPI info, float width, float height) { 065 Color h = Misc.getHighlightColor(); 066 Color g = Misc.getGrayColor(); 067 Color tc = Misc.getTextColor(); 068 float pad = 3f; 069 float opad = 10f; 070 071 072 info.addImage(getFactionForUIColors().getLogo(), width, 128, opad); 073 074 if (warning) { 075 info.addPara("Conditions at " + name + ", a colony belonging to " + 076 faction.getDisplayNameWithArticle() + ", have taken a turn for the worse. Unless the colony " + 077 "is stabilized in some way, it's likely to decivilize and be lost completely in the near future.", 078 opad, faction.getBaseUIColor(), faction.getDisplayNameWithArticleWithoutArticle()); 079 } else if (destroyed) { 080 info.addPara(name + ", a colony formerly belonging to " + 081 faction.getDisplayNameWithArticle() + ", has been destroyed.", 082 opad, faction.getBaseUIColor(), faction.getDisplayNameWithArticleWithoutArticle()); 083 } else { 084 info.addPara(name + ", a colony formerly belonging to " + 085 faction.getDisplayNameWithArticle() + ", has become decivilized. " + 086 "Central authority has collapsed completely and irreversibly, with the remaining " + 087 "population scrambling to survive.", 088 opad, faction.getBaseUIColor(), faction.getDisplayNameWithArticleWithoutArticle()); 089 } 090 091 addBulletPoints(info, ListInfoMode.IN_DESC); 092 } 093 094 @Override 095 public String getIcon() { 096 return Global.getSettings().getSpriteName("intel", "deciv"); 097 } 098 099 @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