149 if (playerFleet.getContainingLocation() instanceof StarSystemAPI) {
150 StarSystemAPI system = (StarSystemAPI) playerFleet.getContainingLocation();
151 String musicSetId = system.getMemoryWithoutUpdate().getString(
MUSIC_SET_MEM_KEY);
152 if (musicSetId !=
null)
return musicSetId;
154 if (system.hasTag(Tags.THEME_CORE) ||
155 !Misc.getMarketsInLocation(system, Factions.PLAYER).isEmpty()) {
156 return "music_campaign";
160 return "music_campaign_non_core";
164 if (param instanceof SectorEntityToken) {
165 SectorEntityToken token = (SectorEntityToken) param;
168 if (musicSetId !=
null)
return musicSetId;
170 if (Entities.ABYSSAL_LIGHT.equals(token.getCustomEntityType())) {
173 if (Entities.CORONAL_TAP.equals(token.getCustomEntityType())) {
176 if (Entities.WRECK.equals(token.getCustomEntityType())) {
179 if (Entities.DERELICT_GATEHAULER.equals(token.getCustomEntityType())) {
183 if (Entities.DEBRIS_FIELD_SHARED.equals(token.getCustomEntityType())) {
184 return "music_survey_and_scavenge";
186 if (token.hasTag(Tags.GATE)) {
189 if (token.hasTag(Tags.SALVAGEABLE)) {
190 if (token.getMemoryWithoutUpdate() !=
null && token.getMemoryWithoutUpdate().getBoolean(
"$hasDefenders")) {
191 if (token.getMemoryWithoutUpdate().getBoolean(
"$limboMiningStation")) {
194 if (token.getMemoryWithoutUpdate().getBoolean(
"$limboWormholeCache")) {
199 return "music_survey_and_scavenge";
201 if (token.hasTag(Tags.SALVAGE_MUSIC)) {
202 return "music_survey_and_scavenge";
205 if (token.getFaction() !=
null) {
206 FactionAPI faction = (FactionAPI) token.getFaction();
209 boolean hostile =
false;
210 boolean knowsWhoPlayerIs =
false;
211 if (token instanceof CampaignFleetAPI) {
212 CampaignFleetAPI fleet = (CampaignFleetAPI) token;
213 if (fleet.getAI() instanceof ModularFleetAIAPI) {
214 hostile = ((ModularFleetAIAPI) fleet.getAI()).isHostileTo(
Global.
getSector().getPlayerFleet());
216 knowsWhoPlayerIs = fleet.knowsWhoPlayerIs();
219 if (faction.isAtWorst(Factions.PLAYER, RepLevel.FAVORABLE) && knowsWhoPlayerIs && !hostile) {
220 type =
"encounter_friendly";
221 }
else if ((faction.isAtBest(Factions.PLAYER, RepLevel.SUSPICIOUS) && knowsWhoPlayerIs) || hostile) {
222 type =
"encounter_hostile";
224 type =
"encounter_neutral";
228 musicSetId = faction.getMusicMap().get(type);
229 if (musicSetId !=
null) {
235 if (faction.isAtWorst(Factions.PLAYER, RepLevel.FAVORABLE)) {
236 musicSetId =
"music_default_encounter_friendly";
237 }
else if (faction.isAtBest(Factions.PLAYER, RepLevel.SUSPICIOUS)) {
238 musicSetId =
"music_default_encounter_hostile";
240 musicSetId =
"music_default_encounter_neutral";
250 if (param instanceof MarketAPI) {
251 MarketAPI market = (MarketAPI) param;
253 String musicSetId = market.getMemoryWithoutUpdate().getString(
MUSIC_SET_MEM_KEY);
254 if (musicSetId !=
null)
return musicSetId;
256 if (market.getPrimaryEntity() !=
null &&
257 market.getPrimaryEntity().getMemoryWithoutUpdate().getBoolean(
"$abandonedStation")) {
261 FactionAPI faction = market.getFaction();
262 if (faction !=
null) {
264 if (faction.isAtWorst(Factions.PLAYER, RepLevel.FAVORABLE)) {
265 type =
"market_friendly";
266 }
else if (faction.isAtBest(Factions.PLAYER, RepLevel.SUSPICIOUS)) {
267 type =
"market_hostile";
269 type =
"market_neutral";
273 musicSetId = faction.getMusicMap().get(type);
274 if (musicSetId !=
null) {
280 if (faction.isAtWorst(Factions.PLAYER, RepLevel.FAVORABLE)) {
281 musicSetId =
"music_default_market_friendly";
282 }
else if (faction.isAtBest(Factions.PLAYER, RepLevel.SUSPICIOUS)) {
283 musicSetId =
"music_default_market_hostile";
285 musicSetId =
"music_default_market_neutral";