GE Lua Documentation

Press F to search!

formatSaveDataForUi

Definition


-- @/lua/ge/extensions/gameplay/missions/progress.lua:1555

local function formatSaveDataForUi(id, onlyKey, includeMostRecentAttempt, fillAttempts)
  local mission = gameplay_missions_missions.getMissionById(id)
  if not mission then
    plog("E", "", "Trying to formatSaveDataForUi nonexitent mission by ID: " .. dumps(id))
    return
  end
  local allProgressKeys = tableKeysSorted(mission.saveData.progress)
  local formattedProgressByKey = {}
  if onlyKey then
    allProgressKeys = { onlyKey }
  end

  local autoRecordings = core_replay.getMissionReplayFiles(mission, true)

  for _, key in ipairs(allProgressKeys) do
    M.ensureProgressExistsForKey(mission, key)
    formattedProgressByKey[key] = {
      attempts = formatAttempts(mission, key, nil, includeMostRecentAttempt, fillAttempts, autoRecordings),
      --aggregates = formatAggregates(mission, key),
      ownAggregate = formatAggregates(mission, key, true)
    }
  end
  local progressKeyTranslations = {}
  for _, key in ipairs(allProgressKeys) do
    progressKeyTranslations[key] = mission.getProgressKeyTranslation and mission:getProgressKeyTranslation(key) or key
  end
  local ret = {
    defaultProgressKey = mission.defaultProgressKey,
    allProgressKeys = allProgressKeys,
    progressKeyTranslations = progressKeyTranslations,
    formattedProgressByKey = formattedProgressByKey,
    unlockedStars = formatStars(mission)
  }
  return ret
end

Callers

@/lua/ge/extensions/flowgraph/modules/uiModule.lua
    description = m.description,
    formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(m.id),
    startable = m.unlocks.startable,
  if not change then dnq = nil end
  local formatted = gameplay_missions_progress.formatSaveDataForUi(mission.id, key, dnq)
  prog.formattedProgress = formatted.formattedProgressByKey[key]
@/lua/ge/extensions/editor/missionEditor/progressMulti.lua
  self.missionInstance = gameplay_missions_missions.getMissionById(mission.id)
  self.formattedSaveData = gameplay_missions_progress.formatSaveDataForUi(mission.id)
  self.currentProgressKey = self.missionInstance.currentProgressKey or self.missionInstance.defaultProgressKey or 'default'
@/lua/ge/extensions/freeroam/vueBigMap.lua
    }
    ret.formattedProgress = gameplay_missions_progress.formatSaveDataForUi(elemData.missionId)
@/lua/ge/extensions/freeroam/bigMapPoiProvider.lua
    }
    ret.formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(elemData.missionId)
    ret.leaderboardKey = mission.defaultLeaderboardKey or 'recent'
@/lua/ge/extensions/gameplay/missions/missionScreen.lua
    -- Format progress for parentInfo
    info.parentInfo.formattedProgress = gameplay_missions_progress.formatSaveDataForUi(parentMission.id)
  end
  info.formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(m.id)
  -- always stock up to 5 elements at least
  local formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(id, progressKey, nil, 5)
   -- pre-format aggregates for the UI. This formatting might be the default later and then be moved to gameplay_missions_progress
    label = m.name,
    formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(m.id),
    startable = m.unlocks.startable,
@/lua/ge/extensions/flowgraph/nodes/ui/endScreen.lua
    local dnq = missionData.leaderboardKey == 'highscore' and not missionData.aggregateChange.aggregateChange.newBestKeysByKey[missionData.leaderboardChangeKeys['highscore']]
    local formatted = gameplay_missions_progress.formatSaveDataForUi(self.mgr.activity.id, key, dnq)
    missionData.formattedProgress = formatted.formattedProgressByKey[key]
@/lua/ge/extensions/flowgraph/nodes/ui/missionEndScreen.lua
    local dnq = missionData.leaderboardKey == 'highscore' and not missionData.aggregateChange.aggregateChange.newBestKeysByKey[missionData.leaderboardChangeKeys['highscore']]
    local formatted = gameplay_missions_progress.formatSaveDataForUi(self.mgr.activity.id, key, dnq)
    missionData.formattedProgress = formatted.formattedProgressByKey[key]
@/lua/ge/extensions/gameplay/markerInteraction.lua
  end
  info.formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(m.id)
  info.leaderboardKey = m.defaultLeaderboardKey or 'recent'
@/lua/ge/extensions/career/modules/branches/landing.lua
    devMission = m.devMission,
    formattedProgress =  gameplay_missions_progress.formatSaveDataForUi(m.id),
    startable = m.unlocks.startable,
@/lua/ge/extensions/editor/missionEditor/progressSingle.lua
  self.missionInstance = gameplay_missions_missions.getMissionById(mission.id)
  self.formattedSaveData = gameplay_missions_progress.formatSaveDataForUi(mission.id)
  -- notify type editor
@/lua/ge/extensions/flowgraph/nodes/ui/startScreen.lua
    local key = self.pinIn.progressKey.value or self.mgr.activity.currentProgressKey or "default"
    local format = gameplay_missions_progress.formatSaveDataForUi(self.mgr.activity.id, key)
    data.formattedProgress = format.formattedProgressByKey[key]