API ReferenceGE Extensionscampaign
Campaign Rewards
Processes and distributes rewards from campaign scenarios - items, vehicles, and player choices.
Processes and distributes rewards from campaign scenarios - items, vehicles, and player choices.
Module Info
| Field | Value |
|---|---|
| Path | extensions/campaign/rewards.lua |
| Global | campaign_rewards |
| Type | Extension |
Public API
| Function | Signature | Description |
|---|---|---|
iterateRewardsConst | (player, callback) | Iterates all inventory rewards for a player via callback(key, value) |
getRewards | (scenarioKey, scenarioData, scenarioResult, medal) | Extracts reward data from scenario result. Filters by medal rank if given |
processRewards | (scenarioKey, scenarioData, scenarioResult, medal) | Processes & distributes rewards: adds items to inventory, handles user choice items |
processUserSelection | (scenarioKey, selectionIndex) | Finalizes a pending user choice reward - adds selection to inventory, sends rest to dealer |
getScenarioReward | (scenarioData, eventName) | (Stub) Returns scenario reward data for an event name. Currently commented out |
State
| Field | Type | Description |
|---|---|---|
M.pendingUserChoices | table | Keyed by scenarioKey - stores pending choice arrays waiting for player selection |
Reward Flow
scenarioResult → getRewards() → processRewards()
├─ direct rewards → core_inventory.addItem()
└─ choice rewards → M.pendingUserChoices[key]
└─ processUserSelection(key, idx)
├─ selected → core_inventory.addItem()
└─ others → campaign_dealer.addToStock()Usage Example
-- Process scenario completion rewards
local rewards = campaign_rewards.processRewards(
"scenario_race01",
scenarioData,
{failed = false},
"gold"
)
-- Handle user vehicle choice (index 2 selected)
campaign_rewards.processUserSelection("scenario_race01", 2)See Also
core_inventory- Item storagecampaign_dealer- Auto dealer stockstatistics_statistics- Medal ranking helpers
Additional Exports
M.getRewards- (undocumented)M.getScenarioReward- (undocumented)M.iterateRewardsConst- (undocumented)M.processRewards- (undocumented)M.processUserSelection- (undocumented)
Campaign Photo Safari
Photo safari mission system for campaign exploration. Players drive to locations, enter photo mode, and capture specific objects within camera constraints.
Career Branches
Manages the career progression hierarchy: domains → branches → skills. Loads branch definitions from `/gameplay/domains/`, computes levels, XP, unlocks, and ordering.