Class BaseEventPlugin
java.lang.Object
com.fs.starfarer.api.impl.campaign.events.BaseEventPlugin
- All Implemented Interfaces:
CampaignEventListener
,CampaignEventPlugin
,CallEvent.CallableEvent
- Direct Known Subclasses:
CivilDisorder
,FactionHostilityEvent
,FleetLogEvent
,FoodShortageEvent
,InvestigationEvent
,InvestigationEventGoodRepWithOther
,InvestigationEventSmugglingV2
,NearbyEventsEvent
,OfficerManagerEvent
,RecentUnrestEvent
,RepTrackerEvent
,TestEvent
,TradeInfoUpdateEvent
,TutorialMissionEvent
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.fs.starfarer.api.campaign.CampaignEventListener
CampaignEventListener.FleetDespawnReason
Nested classes/interfaces inherited from interface com.fs.starfarer.api.campaign.events.CampaignEventPlugin
CampaignEventPlugin.CampaignEventCategory, CampaignEventPlugin.PriceUpdatePlugin
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SectorEntityToken
protected CampaignEventTarget
protected String
protected FactionAPI
protected MarketAPI
protected MemoryAPI
protected boolean
protected float
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addFactionNameTokens
(Map<String, String> tokens, String prefix, FactionAPI faction) static void
void
addTokensToList
(List<String> list, String... keys) void
advance
(float amount) boolean
DO NOT USE, DOES NOT WORK.boolean
callEvent
(String ruleId, InteractionDialogAPI dialog, List<Misc.Token> params, Map<String, MemoryAPI> memoryMap) Called by the CallEvent command (called from rules.csv).void
cleanup()
Called when this instance of the event is removed from the event manager (either due to event being over, or due to event probability dropping to 0).static MarketAPI
findNearestMarket
(MarketAPI from, BaseEventPlugin.MarketFilter filter) The larger image in the message detail.Will be called by SectorAPI.reportEventStage().protected MessagePriority
Override for the "image" normally specified in events.json.Color[]
getHighlightColors
(String stageId) Since multiple reports (possibly from different channels) are possible per stage: 1) All reports must have the highlighted text occur in the same order, which is the order this method returns them in, and 2) Not all highlights have to occur in every report.String[]
getHighlights
(String stageId) Since multiple reports (possibly from different channels) are possible per stage: 1) All reports must have the highlighted text occur in the same order, which is the order this method returns them in, and 2) Not all highlights have to occur in every report.getId()
Unique ID for this instance of the event.protected String
event_stage for when the event is likely, but hasn't happened yet.event_stage for when the event is possible, but hasn't happened yet.Token values for filling out descriptions from reports.csv.Message priority for the "event is likely" report.Message priority for the "event is possible" report.void
increaseRecentUnrest
(float stabilityChange) void
init
(String eventType, CampaignEventTarget eventTarget) Called when the EventProbability for this event is accessed.void
init
(String eventType, CampaignEventTarget eventTarget, boolean addListener) boolean
isDone()
protected boolean
void
reportBattleFinished
(CampaignFleetAPI primaryWinner, BattleAPI battle) void
reportBattleOccurred
(CampaignFleetAPI primaryWinner, BattleAPI battle) Once for each autoresolve round for AI vs AI.void
void
reportEconomyTick
(int iterIndex) void
reportEncounterLootGenerated
(FleetEncounterContextPlugin plugin, CargoAPI loot) void
reportFleetDespawned
(CampaignFleetAPI fleet, CampaignEventListener.FleetDespawnReason reason, Object param) Could be destroyed or simply reached a despawn location.void
reportFleetJumped
(CampaignFleetAPI fleet, SectorEntityToken from, JumpPointAPI.JumpDestination to) from is generally a JumpPointAPI, but doesn't *have* to be.void
reportFleetReachedEntity
(CampaignFleetAPI fleet, SectorEntityToken entity) Planets/stations/etc that are the target of a fleet's assignment.void
void
reportPlayerActivatedAbility
(AbilityPlugin ability, Object param) void
reportPlayerClosedMarket
(MarketAPI market) void
reportPlayerDeactivatedAbility
(AbilityPlugin ability, Object param) void
void
reportPlayerDumpedCargo
(CargoAPI cargo) void
void
reportPlayerMarketTransaction
(PlayerMarketTransaction transaction) void
reportPlayerOpenedMarket
(MarketAPI market) void
void
reportPlayerReputationChange
(PersonAPI person, float delta) void
reportPlayerReputationChange
(String faction, float delta) void
void
Only called when an event is started via CampaignEventManagerAPI.startEvent().void
setProbability
(float p) The probability that the event had of happening, set right before startEvent() is called.void
setTarget
(CampaignEventTarget eventTarget) boolean
If true, messages for an ongoing event will be shown in the intel UI even if they don't meet the "last week/month/cycle" criteria.boolean
void
Called when the event starts.void
startEvent
(boolean addListener) boolean
-
Field Details
-
eventType
-
eventTarget
-
market
-
entity
-
faction
-
statModId
-
started
protected boolean started -
memory
-
startProbability
protected float startProbability
-
-
Constructor Details
-
BaseEventPlugin
public BaseEventPlugin()
-
-
Method Details
-
init
Description copied from interface:CampaignEventPlugin
Called when the EventProbability for this event is accessed. Doesn't mean the event will actually happen.- Specified by:
init
in interfaceCampaignEventPlugin
-
init
-
setTarget
-
getLoggingId
-
cleanup
public void cleanup()Description copied from interface:CampaignEventPlugin
Called when this instance of the event is removed from the event manager (either due to event being over, or due to event probability dropping to 0).- Specified by:
cleanup
in interfaceCampaignEventPlugin
-
startEvent
public void startEvent()Description copied from interface:CampaignEventPlugin
Called when the event starts.- Specified by:
startEvent
in interfaceCampaignEventPlugin
-
startEvent
public void startEvent(boolean addListener) -
isEventStarted
protected boolean isEventStarted() -
advance
public void advance(float amount) - Specified by:
advance
in interfaceCampaignEventPlugin
-
getEventTarget
- Specified by:
getEventTarget
in interfaceCampaignEventPlugin
-
getEventType
- Specified by:
getEventType
in interfaceCampaignEventPlugin
-
getStageIdForLikely
Description copied from interface:CampaignEventPlugin
event_stage for when the event is likely, but hasn't happened yet.- Specified by:
getStageIdForLikely
in interfaceCampaignEventPlugin
- Returns:
-
getStageIdForPossible
Description copied from interface:CampaignEventPlugin
event_stage for when the event is possible, but hasn't happened yet.- Specified by:
getStageIdForPossible
in interfaceCampaignEventPlugin
- Returns:
-
getTokenReplacements
Description copied from interface:CampaignEventPlugin
Token values for filling out descriptions from reports.csv.- Specified by:
getTokenReplacements
in interfaceCampaignEventPlugin
- Returns:
-
addFactionNameTokens
public static void addFactionNameTokens(Map<String, String> tokens, String prefix, FactionAPI faction) -
addPersonTokens
-
getWarningWhenLikelyPriority
Description copied from interface:CampaignEventPlugin
Message priority for the "event is likely" report.- Specified by:
getWarningWhenLikelyPriority
in interfaceCampaignEventPlugin
- Returns:
-
getWarningWhenPossiblePriority
Description copied from interface:CampaignEventPlugin
Message priority for the "event is possible" report.- Specified by:
getWarningWhenPossiblePriority
in interfaceCampaignEventPlugin
- Returns:
-
isDone
public boolean isDone()- Specified by:
isDone
in interfaceCampaignEventPlugin
-
setParam
Description copied from interface:CampaignEventPlugin
Only called when an event is started via CampaignEventManagerAPI.startEvent().- Specified by:
setParam
in interfaceCampaignEventPlugin
-
getTargetName
-
findNearestMarket
-
findMatchingMarkets
-
increaseRecentUnrest
public void increaseRecentUnrest(float stabilityChange) -
reportPlayerMarketTransaction
- Specified by:
reportPlayerMarketTransaction
in interfaceCampaignEventListener
-
reportFleetDespawned
public void reportFleetDespawned(CampaignFleetAPI fleet, CampaignEventListener.FleetDespawnReason reason, Object param) Description copied from interface:CampaignEventListener
Could be destroyed or simply reached a despawn location. Or had too many accidents and lost all of its ships. Or told by other code to despawn itself.- Specified by:
reportFleetDespawned
in interfaceCampaignEventListener
-
reportFleetJumped
public void reportFleetJumped(CampaignFleetAPI fleet, SectorEntityToken from, JumpPointAPI.JumpDestination to) Description copied from interface:CampaignEventListener
from is generally a JumpPointAPI, but doesn't *have* to be.- Specified by:
reportFleetJumped
in interfaceCampaignEventListener
-
reportFleetReachedEntity
Description copied from interface:CampaignEventListener
Planets/stations/etc that are the target of a fleet's assignment.- Specified by:
reportFleetReachedEntity
in interfaceCampaignEventListener
-
allowMultipleOngoingForSameTarget
public boolean allowMultipleOngoingForSameTarget()Description copied from interface:CampaignEventPlugin
DO NOT USE, DOES NOT WORK. Should always return false.- Specified by:
allowMultipleOngoingForSameTarget
in interfaceCampaignEventPlugin
- Returns:
-
getHighlights
Description copied from interface:CampaignEventPlugin
Since multiple reports (possibly from different channels) are possible per stage: 1) All reports must have the highlighted text occur in the same order, which is the order this method returns them in, and 2) Not all highlights have to occur in every report.- Specified by:
getHighlights
in interfaceCampaignEventPlugin
- Returns:
-
getHighlightColors
Description copied from interface:CampaignEventPlugin
Since multiple reports (possibly from different channels) are possible per stage: 1) All reports must have the highlighted text occur in the same order, which is the order this method returns them in, and 2) Not all highlights have to occur in every report.- Specified by:
getHighlightColors
in interfaceCampaignEventPlugin
- Returns:
-
addTokensToList
-
getEventName
- Specified by:
getEventName
in interfaceCampaignEventPlugin
-
getEventCategory
- Specified by:
getEventCategory
in interfaceCampaignEventPlugin
-
getDefaultPriority
-
getRelatedCommodities
- Specified by:
getRelatedCommodities
in interfaceCampaignEventPlugin
-
getPriceUpdates
- Specified by:
getPriceUpdates
in interfaceCampaignEventPlugin
-
reportShownInteractionDialog
- Specified by:
reportShownInteractionDialog
in interfaceCampaignEventListener
-
reportPlayerOpenedMarket
- Specified by:
reportPlayerOpenedMarket
in interfaceCampaignEventListener
-
getCurrentMessageIcon
Description copied from interface:CampaignEventPlugin
Will be called by SectorAPI.reportEventStage(). Can change between calls. The priority for icons is: 1) Icon configured in reports.csv for the specific report 2) Return value of this method 3) Event's icon (via getEventIcon() and then from events.json) 4) Channel's icon, if message isn't related to an event or the event has no icon.- Specified by:
getCurrentMessageIcon
in interfaceCampaignEventPlugin
- Returns:
-
getCurrentImage
Description copied from interface:CampaignEventPlugin
The larger image in the message detail.- Specified by:
getCurrentImage
in interfaceCampaignEventPlugin
- Returns:
-
getEventIcon
Description copied from interface:CampaignEventPlugin
Override for the "image" normally specified in events.json. Small.- Specified by:
getEventIcon
in interfaceCampaignEventPlugin
- Returns:
-
showAllMessagesIfOngoing
public boolean showAllMessagesIfOngoing()Description copied from interface:CampaignEventPlugin
If true, messages for an ongoing event will be shown in the intel UI even if they don't meet the "last week/month/cycle" criteria.- Specified by:
showAllMessagesIfOngoing
in interfaceCampaignEventPlugin
- Returns:
-
reportPlayerReputationChange
- Specified by:
reportPlayerReputationChange
in interfaceCampaignEventListener
-
reportPlayerEngagement
- Specified by:
reportPlayerEngagement
in interfaceCampaignEventListener
-
reportFleetSpawned
- Specified by:
reportFleetSpawned
in interfaceCampaignEventListener
-
reportPlayerOpenedMarketAndCargoUpdated
- Specified by:
reportPlayerOpenedMarketAndCargoUpdated
in interfaceCampaignEventListener
-
reportEncounterLootGenerated
- Specified by:
reportEncounterLootGenerated
in interfaceCampaignEventListener
-
reportPlayerClosedMarket
- Specified by:
reportPlayerClosedMarket
in interfaceCampaignEventListener
-
callEvent
public boolean callEvent(String ruleId, InteractionDialogAPI dialog, List<Misc.Token> params, Map<String, MemoryAPI> memoryMap) Description copied from interface:CampaignEventPlugin
Called by the CallEvent command (called from rules.csv).- Specified by:
callEvent
in interfaceCallEvent.CallableEvent
- Specified by:
callEvent
in interfaceCampaignEventPlugin
-
getMemory
- Specified by:
getMemory
in interfaceCampaignEventPlugin
-
getId
Description copied from interface:CampaignEventPlugin
Unique ID for this instance of the event.- Specified by:
getId
in interfaceCampaignEventPlugin
- Returns:
-
getStatModId
-
reportPlayerReputationChange
- Specified by:
reportPlayerReputationChange
in interfaceCampaignEventListener
-
reportPlayerActivatedAbility
- Specified by:
reportPlayerActivatedAbility
in interfaceCampaignEventListener
-
reportPlayerDeactivatedAbility
- Specified by:
reportPlayerDeactivatedAbility
in interfaceCampaignEventListener
-
reportBattleFinished
- Specified by:
reportBattleFinished
in interfaceCampaignEventListener
-
reportBattleOccurred
Description copied from interface:CampaignEventListener
Once for each autoresolve round for AI vs AI. Only once per player battle encounter.- Specified by:
reportBattleOccurred
in interfaceCampaignEventListener
-
setProbability
public void setProbability(float p) Description copied from interface:CampaignEventPlugin
The probability that the event had of happening, set right before startEvent() is called. Set to 1 by events started using CampaignEventManagerAPI.startEvent().- Specified by:
setProbability
in interfaceCampaignEventPlugin
-
useEventNameAsId
public boolean useEventNameAsId()- Specified by:
useEventNameAsId
in interfaceCampaignEventPlugin
-
showLatestMessageIfOngoing
public boolean showLatestMessageIfOngoing()- Specified by:
showLatestMessageIfOngoing
in interfaceCampaignEventPlugin
-
reportPlayerDumpedCargo
- Specified by:
reportPlayerDumpedCargo
in interfaceCampaignEventListener
-
reportPlayerDidNotTakeCargo
- Specified by:
reportPlayerDidNotTakeCargo
in interfaceCampaignEventListener
-
reportEconomyMonthEnd
public void reportEconomyMonthEnd()- Specified by:
reportEconomyMonthEnd
in interfaceCampaignEventListener
-
reportEconomyTick
public void reportEconomyTick(int iterIndex) - Specified by:
reportEconomyTick
in interfaceCampaignEventListener
-