GE Lua Documentation

Press F to search!

formatSaveDataForBigmap

Definition


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

local function formatSaveDataForBigmap(id)
  local mission = gameplay_missions_missions.getMissionById(id)
  if not mission then
    plog("E", "", "Trying to saveMissionAttempt nonexitent mission by ID: " .. dumps(id))
    return
  end
  local ret = {}
  local bigmapConf = mission.autoUiBigmap or {}
  bigmapConf.rating = bigmapConf.rating or {}

  for key, conf in pairs(bigmapConf.aggregates or {}) do
    local sd = mission.saveData.progress[conf.progressKey or mission.defaultProgressKey]
    if sd then
      local agg = sd.aggregate or {}
      ret[key] = {
        label = { text = conf.label, context = {} },
        value = tryFormatValueForFunction(getValueForAggregateUiProgressType(agg, conf), conf.formatFunction, mission)
      }
    end
  end

  ret.rating = {}

  local agg = (mission.saveData.progress[bigmapConf.rating.progressKey or mission.defaultProgressKey] or {}).aggregate or {}

  if not mission.unlocks.startable then
    ret.rating = { type = 'locked' }
  elseif agg.attemptCount == 0 then
    ret.rating = { type = 'new' }
  elseif agg.completed then
    ret.rating = { type = 'done' }
  else
    ret.rating = { type = 'attempts', attempts = agg.attemptCount }
  end

  ret.unlockedStars = formatStars(mission)

  return ret
end

Callers

@/lua/ge/extensions/freeroam/bigMapPoiProvider.lua

    for key, val in pairs(gameplay_missions_progress.formatSaveDataForBigmap(mission.id) or {}) do
      ret[key] = val
@/lua/ge/extensions/gameplay/missions/missions.lua
      local m = gameplay_missions_missions.getMissionById(elem.missionId)
      local saveData = gameplay_missions_progress.formatSaveDataForBigmap(m.id)
      local heading = m.name or elem.missionId or "Unknown Mission...?"
@/lua/ge/extensions/freeroam/vueBigMap.lua

    for key, val in pairs(gameplay_missions_progress.formatSaveDataForBigmap(mission.id) or {}) do
      ret[key] = val