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.CampaignFleetAPI;
007import com.fs.starfarer.api.campaign.FactionAPI;
008import com.fs.starfarer.api.campaign.SectorEntityToken;
009import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
010import com.fs.starfarer.api.impl.campaign.ids.Factions;
011import com.fs.starfarer.api.impl.campaign.ids.Tags;
012import com.fs.starfarer.api.loading.Description;
013import com.fs.starfarer.api.loading.Description.Type;
014import com.fs.starfarer.api.ui.SectorMapAPI;
015import com.fs.starfarer.api.ui.TooltipMakerAPI;
016import com.fs.starfarer.api.util.Misc;
017
018public class RemnantNexusIntel extends MapMarkerIntel {
019
020        public RemnantNexusIntel(CampaignFleetAPI entity) {
021                
022                //String icon = Global.getSettings().getSpriteName("intel", "remnant_nexus");
023                String title = entity.getNameWithFactionKeepCase();
024                
025                String text = null;
026//              if (entity.getStarSystem() != null) {
027//                      text = "Located in the " + entity.getStarSystem().getNameWithLowercaseTypeShort();
028//              }
029                setSound("ui_discovered_entity");
030                
031                setWithDeleteButton(false);
032                //setWithTimestamp(false);
033                
034                init(entity, title, text, null, true);
035        }
036        
037        @Override
038        public String getIcon() {
039                return Global.getSettings().getSpriteName("intel", "remnant_nexus");
040        }
041
042        @Override
043        public FactionAPI getFactionForUIColors() {
044                return entity.getFaction();
045        }
046        
047        public boolean isDamaged() {
048                return entity.getMemoryWithoutUpdate().getBoolean("$damagedStation");
049        }
050        
051        @Override
052        protected boolean withTextInDesc() {
053                return false;
054        }
055
056        @Override
057        protected boolean withCustomVisual() {
058                return true;
059        }
060
061        @Override
062        protected boolean withCustomDescription() {
063                return true;
064        }
065
066        @Override
067        protected void addCustomVisual(TooltipMakerAPI info, float width, float height) {
068                info.addImage(Global.getSector().getFaction(Factions.REMNANTS).getLogo(), width, 10f);
069        }
070        
071
072        @Override
073        protected void addCustomDescription(TooltipMakerAPI info, float width, float height) {
074                Description desc = Global.getSettings().getDescription("remnant_station2", Type.SHIP);
075                if (desc != null) {
076                        float opad = 10f;
077                        info.addPara(desc.getText1FirstPara(), opad);
078                        if (isDamaged()) {
079                                info.addPara("The station's long arc gapes with empty sockets where weapons platforms "
080                                                + "and citadels were once present. Despite the obvious damage, "
081                                                + "the station is armed and operational.",  opad);
082                        }
083                }
084        }
085
086        
087        public static RemnantNexusIntel getNexusIntel(SectorEntityToken entity) {
088                for (IntelInfoPlugin intel : Global.getSector().getIntelManager().getIntel(RemnantNexusIntel.class)) {
089                        if (((RemnantNexusIntel)intel).getEntity() == entity) return (RemnantNexusIntel)intel;
090                }
091                return null;
092        }
093
094        @Override
095        public Set<String> getIntelTags(SectorMapAPI map) {
096                Set<String> tags = super.getIntelTags(map);
097                //tags.remove(Tags.INTEL_FLEET_LOG);
098                tags.add(Factions.REMNANTS);
099                if (!Misc.getMarketsInLocation(entity.getStarSystem(), Factions.PLAYER).isEmpty()) {
100                        tags.add(Tags.INTEL_COLONIES);
101                }
102                return tags;
103        }
104        
105        
106}
107
108
109
110