Simulator::cMission class

Base class for all missions, this class cannot be instantiated.

Base classes

class cGameData
Base class for most Simulator objects.
class App::IMessageListener
An interface that can receive messages sent through the app.

Public static variables

static const uint32_t TYPE

Public functions

auto SetState(MissionState state) -> void
Changes the state of the mission.
auto GetOwnerEmpire() -> cEmpire*
Returns the empire that created this mission.
auto GetTargetEmpire() -> cEmpire*
Returns the target empire of this mission.
auto SetTargetEmpire(cEmpire* pEmpire) -> void
Sets the target empire of this mission.
auto func54h() -> int virtual
auto func58h() -> int virtual
auto func5Ch() -> int virtual
auto GetState() -> int virtual
auto func64h() -> bool virtual
auto func68h() -> bool virtual
auto func6Ch() -> void virtual
auto func70h() -> void virtual
auto GetCardWindowControlID() -> uint32_t virtual
auto Initialize() -> void virtual
auto Update(int deltaTime) -> MissionState virtual
Only called when state is Active, called every frame.
auto Load() -> void virtual
Loads prop file.
auto ShutdownSystems() -> void virtual
Calling when destroying the mission, if mSystemsShutdown is false.
auto OnMissionAccept() -> void virtual
Called when the player accepts the mission.
auto OnMissionReject() -> void virtual
Called when the mission is rejected.
auto OnMissionAbort() -> void virtual
Called when the mission is aborted.
auto OnMissionCompleted() -> void virtual
Called when the mission is completed.
auto OnMissionFailed() -> void virtual
Called when the mission is failed.
auto FailMission() -> void virtual
Causes this mission to fail.
auto GetDescription(eastl::string16* dst) -> eastl::string16* virtual
Returns a description for this mission, usually the description property in the prop list.
auto GetConversationID() -> uint32_t virtual
Returns the ID of a .cnv conversation file used for the mission.
auto GetDuration() -> int virtual
Returns how much time the mission can last, in milliseconds. 0 if there is no time limit.
auto GetRemainingTime() -> int virtual
For missions with a time limit, returns how much time is left (duration - elapsedTime). Otherwise, returns 0.
auto GetTargetAnimalSpecies() -> cSpeciesProfile* virtual
auto GetTargetAnimalSpeciesNameText(eastl::string16& dst) -> void virtual
auto GetTitleText(eastl::string16& dst) -> void virtual
auto GetUIMediumDescText(eastl::string16& dst) -> void virtual
auto GetUILongDescText(eastl::string16& dst) -> void virtual
auto funcC4h(eastl::string16& dst) -> void virtual
auto GetAlertTitleText(eastl::string16& dst) -> void virtual
"Mission" or "Alert"
auto GetStarClueText(int index, eastl::string16& dst) -> void virtual
auto GetStarClueDistanceText(eastl::string16& dst) -> void virtual
auto GetStarClueRangeMinText(eastl::string16& dst) -> void virtual
auto GetStarClueRangeMaxText(eastl::string16& dst) -> void virtual
auto GetPlanetClueOrbitOrderText(eastl::string16& dst) -> void virtual
auto GetPlanetClueText(eastl::string16& dst) -> void virtual
auto GetStarMapEffectGroup() -> uint32_t virtual
auto GetStarMapEffect() -> uint32_t virtual
auto GetTravelCost() -> int virtual
Returns how much money it costs to travel from the source planet to the target planet and back.
auto GetTravelDistance() -> float virtual
Returns how much distance to travel from the source planet to the target planet and back.
auto IsTargetPlanet(cPlanetRecord* pPlanetRecord) -> bool virtual
Returns true if the given planet is the target planet of the mission, or false otherwise.
auto HasBeenFulfilled() -> bool virtual
auto HasFailed() -> bool virtual
auto func100h() -> bool virtual
auto func104h() -> bool virtual
auto func108h() -> int virtual
auto func10Ch() -> uint32_t virtual
auto func110h(int, int) -> uint32_t virtual
auto func114h() -> void virtual
auto TranslateToken(uint32_t tokenID, eastl::string16& dst) -> bool virtual
Called by the space token translator, used to replace special tokens in localized texts.
auto GetCompletedEventLogID() -> uint32_t virtual
By default, event_log_return_for_rewards
auto func120h() -> bool virtual
auto func120h(int) -> void virtual
auto CreateClues() -> bool virtual
Creates the star and planet clues for finding landmarks, only if they are not disabled with the kMissionFlagHideStarName and kMissionFlagHidePlanetName flags.
auto CreateStarClue() -> bool virtual
Chooses one nearby star where a landmark must be found, and enables the mStarClue accordingly.
auto CreatePlanetClue() -> bool virtual
auto IsSourcePlanetAndEmpire(uint32_t empireId, PlanetID planetId) -> bool virtual
Returns true if the mission is Active or Complete, and the given empire and planet are the empire and planet where the mission originated.
auto HasEnoughAvailableCargoSlots() -> bool virtual
Checks if the player has enough available cargo slots in the inventory to give the animals and plants of the mission (mGiveOnAcceptAnimalIDs and mGiveOnAcceptPlantIDs).
auto func13Ch() -> bool virtual
auto func140h(int, int) -> bool virtual
auto AddMessageListeners() -> void virtual
Adds this mission as listener to some game messages.
auto RemoveMessageListeners() -> void virtual
auto AddMessageListener(uint32_t messageId) -> void virtual
auto RemoveMessageListener(uint32_t messageId) -> void virtual
auto ListensToMessage(uint32_t messageId) -> bool virtual
Returns true if the mission is a listener to the given game internal message.
auto func158h() -> bool virtual
auto func15Ch() -> bool virtual
auto func160h() -> int virtual
auto func164h() -> int virtual
auto func168h() -> bool virtual
auto func16Ch() -> void virtual
auto ExportTargetPlanetAndSpecies() -> void virtual
Reads properties missionExportTargetPlanetTo and missionExportTargetSpeciesTo.
auto func174h(int) -> void virtual
auto func178h() -> uint32_t virtual
auto GetCreatureGoalCardLayoutId() -> uint32_t virtual
auto func180h() -> bool virtual
auto func184h(int, int) -> float virtual
auto CalculateMissionDuration() -> int virtual
auto PickTargetAnimalSpecies() -> bool virtual
Sets mTargetAnimalSpecies and mTargetAnimalSpeciesKey.
auto func190h(const ResourceKey& speciesId) -> void virtual
auto func194h() -> void virtual
auto func198h(bool) -> bool virtual
auto func19Ch() -> void virtual
auto func1A0h(bool) -> void virtual
auto AddRef() -> int pure virtual
auto Release() -> int pure virtual
auto Cast(uint32_t typeID) const -> void* pure virtual

Public variables

cGonzagoTimer field_38
cGonzagoTimer field_58
uint32_t mMissionID
unsigned int mElapsedTimeMS
int mDuration
MissionState mState
bool mSystemsShutdown
uint32_t mOwnerEmpireID
cEmpirePtr mpOwnerEmpire
Owner empire. Use GetOwnerEmpire()
uint32_t mTargetEmpireID
cEmpirePtr mpTargetEmpire
Owner empire. Use GetTargetEmpire() and SetTargetEmpire()
cPlanetPtr mpSourcePlanet
float mRewardMoney
ResourceKey mRewardToolID
LocalizedString field_B0
cStarClue mStarClue
cPlanetClue mPlanetClue
uint32_t mStarMapIconEffectID
int field_104
eastl::vector<int> field_108
eastl::vector<ResourceKey> mUnlockToolIDList
int mFlags
eastl::vector<int> field_134
uint32_t mProgressEventID
eastl::string16 mTitle
eastl::string16 field_15C
cSpeciesProfile* mTargetAnimalSpecies
ResourceKey mTargetAnimalSpeciesKey
cMissionPtr mpParentMission
PropertyListPtr mpPropList
int mAcceptCost
int mToolCost
bool field_18C
int mGiveOnAcceptMoney
eastl::vector<ResourceKey> mGiveOnAcceptToolIDs
eastl::vector<ResourceKey> mGiveOnAcceptAnimalIDs
eastl::vector<ResourceKey> mGiveOnAcceptPlantIDs
eastl::vector<uint32_t> field_1D0
cCommEventPtr mpGalaxyCommEvent
cPlanetPtr mpTargetPlanet

Function documentation

void Simulator::cMission::SetState(MissionState state)

Changes the state of the mission.

Parameters
state

Sets mTitle and field_15C to an empty eastl::string. If the new state is MissionState::Active, emits a SimulatorMessages::kMsgMissionUpdate message.

cEmpire* Simulator::cMission::GetOwnerEmpire()

Returns the empire that created this mission.

This will return mpOwnerEmpire, or set it to the empire of mpOwnerEmpireID if not set.

cEmpire* Simulator::cMission::GetTargetEmpire()

Returns the target empire of this mission.

This will return mpTargetEmpire, or set it to the empire of mpTargetEmpireID if not set.

void Simulator::cMission::SetTargetEmpire(cEmpire* pEmpire)

Sets the target empire of this mission.

Parameters
pEmpire

MissionState Simulator::cMission::Update(int deltaTime) virtual

Only called when state is Active, called every frame.

Parameters
deltaTime
Returns New state of the mission.

Default behaviour:

  1. Updates mElapsedTimeMS, and if it is greater than the mission max duration, fails the mission.
  2. Calls func168h()
  3. Updates clocks field_38 and field_58, and sends message 0x38CF2FD sometimes
  4. If field_18C and player is in galaxy context, calls func1A0h()

void Simulator::cMission::OnMissionCompleted() virtual

Called when the mission is completed.

Default behaviour:

  1. If mission is a tutorial, it changes MissionManager.mTutorialMissionStates
  2. If mission is an adventure, advances some variable on player empire
  3. Unlocks (or gives?) the tools in mUnlockToolIDList
  4. Unlocks (or gives?) the tool in mRewardToolID
  5. Adds mRewardMoney to player empire money
  6. Applies empire relationships ... more things ...

eastl::string16* Simulator::cMission::GetDescription(eastl::string16* dst) virtual

Returns a description for this mission, usually the description property in the prop list.

Parameters
dst The eastl::string where the description will be stored

uint32_t Simulator::cMission::GetConversationID() virtual

Returns the ID of a .cnv conversation file used for the mission.

If the mission has a parent, it will return the conversation of the parent.

bool Simulator::cMission::IsTargetPlanet(cPlanetRecord* pPlanetRecord) virtual

Returns true if the given planet is the target planet of the mission, or false otherwise.

Parameters
pPlanetRecord

bool Simulator::cMission::TranslateToken(uint32_t tokenID, eastl::string16& dst) virtual

Called by the space token translator, used to replace special tokens in localized texts.

Parameters
tokenID id of the token (the token is a text, this is the FNV hash)
dst Where the token text must be written.
Returns True if the token was processed, false otherwise.

For example, it is used to provide the target planet name, target species, etc

bool Simulator::cMission::CreateStarClue() virtual

Chooses one nearby star where a landmark must be found, and enables the mStarClue accordingly.

The maximum star distance is determined by the property missionLandmarkSearchRadius

bool Simulator::cMission::IsSourcePlanetAndEmpire(uint32_t empireId, PlanetID planetId) virtual

Returns true if the mission is Active or Complete, and the given empire and planet are the empire and planet where the mission originated.

Parameters
empireId
planetId

bool Simulator::cMission::HasEnoughAvailableCargoSlots() virtual

Checks if the player has enough available cargo slots in the inventory to give the animals and plants of the mission (mGiveOnAcceptAnimalIDs and mGiveOnAcceptPlantIDs).

Returns True if it has enough cargo slots, false otherwise.

void Simulator::cMission::AddMessageListeners() virtual

Adds this mission as listener to some game messages.

By default, it listens to 0x35EC3DE, 0x248975F, 0x2489760, 0x4249453

bool Simulator::cMission::ListensToMessage(uint32_t messageId) virtual

Returns true if the mission is a listener to the given game internal message.

Parameters
messageId

void Simulator::cMission::ExportTargetPlanetAndSpecies() virtual

Reads properties missionExportTargetPlanetTo and missionExportTargetSpeciesTo.

If set, it sets the mission target planet and species id as the tutorial ones in MissionManager.

bool Simulator::cMission::PickTargetAnimalSpecies() virtual

Sets mTargetAnimalSpecies and mTargetAnimalSpeciesKey.

Returns

By default, it just picks a random creature from the planet.