001package com.fs.starfarer.api.impl.campaign.intel.misc;
002
003import java.util.Set;
004
005import com.fs.starfarer.api.Global;
006import com.fs.starfarer.api.campaign.FactionAPI;
007import com.fs.starfarer.api.campaign.SectorEntityToken;
008import com.fs.starfarer.api.campaign.TextPanelAPI;
009import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
010import com.fs.starfarer.api.impl.campaign.econ.impl.Cryorevival;
011import com.fs.starfarer.api.impl.campaign.ids.Industries;
012import com.fs.starfarer.api.loading.IndustrySpecAPI;
013import com.fs.starfarer.api.ui.SectorMapAPI;
014import com.fs.starfarer.api.ui.TooltipMakerAPI;
015import com.fs.starfarer.api.util.Misc;
016
017public class CryosleeperIntel extends MapMarkerIntel {
018
019        public CryosleeperIntel(SectorEntityToken entity, TextPanelAPI textPanel) {
020                
021                //String icon = Global.getSettings().getSpriteName("intel", "cryosleeper");
022                String title = entity.getName();
023                
024                String text = null;
025//              if (entity.getStarSystem() != null) {
026//                      text = "Located in the " + entity.getStarSystem().getNameWithLowercaseTypeShort();
027//              }
028                setSound("ui_discovered_entity");
029                
030                setWithDeleteButton(false);
031                //setWithTimestamp(false);
032                
033                init(entity, title, text, null, true, textPanel);
034        }
035        
036        @Override
037        public String getIcon() {
038                return Global.getSettings().getSpriteName("intel", "cryosleeper");
039        }
040
041        @Override
042        public FactionAPI getFactionForUIColors() {
043                return entity.getFaction();
044        }
045        
046        @Override
047        protected boolean withTextInDesc() {
048                return false;
049        }
050        
051        @Override
052        protected void addPostDescriptionSection(TooltipMakerAPI info, float width, float height, float opad) {
053                if (!entity.getMemoryWithoutUpdate().getBoolean("$hasDefenders")) {
054                        IndustrySpecAPI spec = Global.getSettings().getIndustrySpec(Industries.CRYOREVIVAL);
055                        info.addPara("Allows colonies within %s light-years to build a %s, "
056                                        + "greatly increasing their population growth.", 
057                                        opad, Misc.getHighlightColor(), "" + (int)Cryorevival.MAX_BONUS_DIST_LY, spec.getName());
058                }
059        }
060
061        public static CryosleeperIntel getCryosleeperIntel(SectorEntityToken entity) {
062                for (IntelInfoPlugin intel : Global.getSector().getIntelManager().getIntel(CryosleeperIntel.class)) {
063                        if (((CryosleeperIntel)intel).getEntity() == entity) return (CryosleeperIntel)intel;
064                }
065                return null;
066        }
067
068        @Override
069        public Set<String> getIntelTags(SectorMapAPI map) {
070                Set<String> tags = super.getIntelTags(map);
071                //tags.add(Tags.INTEL_);
072                return tags;
073        }
074        
075        
076}
077
078
079
080