001package com.fs.starfarer.api.impl.campaign.intel.misc; 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.impl.campaign.GateEntityPlugin; 010import com.fs.starfarer.api.impl.campaign.ids.Tags; 011import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin; 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 GateIntel extends BaseIntelPlugin { 019 020 protected SectorEntityToken gate; 021 022 public GateIntel(SectorEntityToken gate) { 023 this.gate = gate; 024 //Global.getSector().getIntelManager().addIntel(this); 025 } 026 027 protected void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode) { 028 029 boolean active = GateEntityPlugin.isActive(gate); 030 031 Color h = Misc.getHighlightColor(); 032 Color g = Misc.getGrayColor(); 033 float pad = 3f; 034 float opad = 10f; 035 036 float initPad = pad; 037 if (mode == ListInfoMode.IN_DESC) initPad = opad; 038 039 Color tc = getBulletColorForMode(mode); 040 041 bullet(info); 042 boolean isUpdate = getListInfoParam() != null; 043 044// if (mode == ListInfoMode.INTEL) { 045// info.addPara("Located in the " + gate.getContainingLocation().getNameWithLowercaseTypeShort(), tc, initPad); 046// initPad = 0f; 047// } 048 049 if (GateEntityPlugin.isScanned(gate)) { 050 info.addPara("Scanned", tc, initPad); 051 initPad = 0f; 052 } 053 054 unindent(info); 055 } 056 057 058 @Override 059 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) { 060 String pre = ""; 061 String post = ""; 062 if (mode == ListInfoMode.MESSAGES) { 063 pre = "Discovered: "; 064 } 065 066 if (mode == ListInfoMode.INTEL) { 067 post = " - " + gate.getContainingLocation().getNameWithTypeShort(); 068 } 069 070 071 Color c = getTitleColor(mode); 072 info.addPara(pre + getName() + post, c, 0f); 073 addBulletPoints(info, mode); 074 } 075 076 @Override 077 public void createSmallDescription(TooltipMakerAPI info, float width, float height) { 078 Color h = Misc.getHighlightColor(); 079 Color g = Misc.getGrayColor(); 080 Color tc = Misc.getTextColor(); 081 float pad = 3f; 082 float opad = 10f; 083 084 if (gate.getCustomInteractionDialogImageVisual() != null) { 085 info.addImage(gate.getCustomInteractionDialogImageVisual().getSpriteName(), width, opad); 086 } 087 088 Description desc = Global.getSettings().getDescription(gate.getCustomDescriptionId(), Type.CUSTOM); 089 info.addPara(desc.getText1(), opad); 090 091 if (GateEntityPlugin.isScanned(gate)) { 092 if (GateEntityPlugin.canUseGates()) { 093 info.addPara("You've scanned this gate and are able to transit it.", opad); 094 } else { 095 info.addPara("You've scanned this gate.", opad); 096 } 097 } 098 099 //addBulletPoints(info, ListInfoMode.IN_DESC); 100 101 } 102 103 protected boolean isActive() { 104 return GateEntityPlugin.isActive(gate); 105 } 106 107 @Override 108 public String getIcon() { 109 if (isActive()) { 110 return Global.getSettings().getSpriteName("intel", "gate_active"); 111 } 112 return Global.getSettings().getSpriteName("intel", "gate_inactive"); 113 } 114 115 @Override 116 public Set<String> getIntelTags(SectorMapAPI map) { 117 Set<String> tags = super.getIntelTags(map); 118 tags.add(Tags.INTEL_GATES); 119 return tags; 120 } 121 122 public String getSortString() { 123 if (isActive()) { 124 return "Active Gate " + gate.getName(); 125 } 126 return "Inactive Gate " + gate.getName(); 127 } 128 129 130 131 public String getName() { 132 return gate.getName(); 133 } 134 135 @Override 136 public FactionAPI getFactionForUIColors() { 137 return super.getFactionForUIColors(); 138 } 139 140 public String getSmallDescriptionTitle() { 141 return getName() + " - " + gate.getContainingLocation().getNameWithTypeShort(); 142 } 143 144 @Override 145 public SectorEntityToken getMapLocation(SectorMapAPI map) { 146 return gate; 147 } 148 149 @Override 150 public boolean shouldRemoveIntel() { 151 return false; 152 } 153 154 @Override 155 public String getCommMessageSound() { 156 return "ui_discovered_entity"; 157 } 158 159 public SectorEntityToken getGate() { 160 return gate; 161 } 162 163 164} 165 166 167 168 169 170 171