Skip to content

EventContent

IEventContent

IEventContent is an extension of IContent that allows for a Milestone-based" progression instead of an IStage based progression. A combination of both progression types is also possible.

Note

This is usually implemented as a Limited Time Event feature where players have a period of time to complete as many milestones as possible and claim their rewards after the event has ended.

As a player plays an IEventContent, they complete a linear track of IMilestone objects. Each milestone targets a specific ICurrency and specifies a target amount. These rewards exist in the main IContent, so an IEventSettings object is used to map IMilestone rewards to their counterpart entries in the core IContent.

Once a player is ready to claim their rewards, a globally available IEventSettings object is used via the IEventService to claim them when the player has returned to the main IContent. Refer to EventSettings for more information.

Note

This is done to avoid potential situations where data for the IEventContent is not available.

EventContent

A concrete implementation of IEventContent. Along with the concrete implementations of other event-related interfaces, this provides everything required to run an event.

Relationships

eventcontent_relation

  • IEventContent — This interface extends IContent and defines a list of IMilestone objects as well as properties for IEventContentData.

  • IEventContentData — This interface extends IContentData and contains a list of IMilestoneData ids.

Note

There is no IEventContentSavedData as the IEventContent just uses the IContentSavedData

  • IMilestone — This interface defines properties for IMilestoneData and IMilestoneSavedData, as well as properties associated with milestone progress and methods to activate and deactivate them.

  • IMilestoneData — This interface defines properties for the target ICurrency and the amount of ICurrency to collect.

  • IMilestoneSavedData — This interface defines a property used to serialize the milestone progress.

See EventSettings for more information on the rest of this diagram.

Runtime Flow

eventcontent_runtime

Milestone Logic

When an IContent is loaded, a check is done to determine if it is an IEventContent instance. If this is true, IMilestone objects are loaded and the current IMilestone is activated.

An active IMilestone tracks the ICurrency defined at CurrencyId and sends a ProgressMilestoneStateAction each time it detects a positive change in that currency. Once the IMilestone has surpassed the TargetAmount it dispatches a MilestoneClaimableAction.

IEventContent listens to the MilestoneClaimableAction and updates the MilestoneCompletionInfo associated with IMilestoneData Id.

The next eligible (not completed) IMilestone in the list is then activated if one exists, and the process repeats until all milestones are claimable or the event has finished.

Note

In addition to completing the IMilestone when its target is reached while playing the event, IdleKit provides another way to determine the completion time of the milestones using the Projection Service. If the player has automated any generator, the IProjectionService will calculate an estimated completion time for the milestones. The projected (estimated) completion time will be stored in the MilestoneCompletionInfo that are used during the rewards claiming process.

Reward Claiming

After an event is complete, the reward claiming process can be performed in a IContent Id that matches ClaimInContentId.

The claiming process look into the milestones and rewards mappings in the associated MilestoneCompletionInfo. Each MilestoneCompletionInfo contains a timestamp and the corresponding milestone. If any timestamp from the list of MilestoneCompletionInfo is before the event endTime, a ClaimEventRewardsStateAction will be dispatched to grant the rewards associated with the completed milestones and set the boolean value AreRewardsClaimed to true.

The claiming process also takes account of the event leaderboard rank rewards. After the player's final rank on the event's leaderboard and corresponding rank reward is calculated by the @IdleKit.Gameplay.IEventLeaderboardsServices, a ClaimEventRankRewardsStateAction will be dispatched to grant the @IdleKit.Gameplay.IEventSettingsData.RankRewards and set the boolean value @IdleKit.Gameplay.IEventSettingsSavedData.AreRankRewardsClaimed to true.

Clearing Event Saved Data

Each limited-time event is identified based on an EventContentId. When loading an IContent, all saved data (except for rewards data) is deleted if the following condition is true: - The player has already played an event which is made from the same IContent as the event the player is currenty entering.

If the user is in an expired Content, they are forced into the main Content.

Note

The IEventSettings is global and static, so it is not deleted when the event has expired.