GE Lua Documentation

Press F to search!

getBranchLevelForCondition

Definition


-- @/lua/ge/extensions/gameplay/missions/unlocks.lua:160

-- recursively gets all branch level requirements in conditions (branchLevel)
local function getBranchLevelForCondition(cond, list)
  if cond.nested then
    for _, n in ipairs(cond.nested) do
      M.getBranchLevelForCondition(n, list)
    end
  else
    if cond.type == "branchLevel" then
      list[cond.branchId] = cond.level
    end
    if cond.type == "league" and career_modules_branches_leagues then
      local league = career_modules_branches_leagues.getLeagueById(cond.leagueId)
      if league then
        if league.branchId then
          list[league.branchId] = 1
        else
          log("W", "gameplay_missions_unlocks", "League " .. cond.leagueId .. " has no branchId")
          dump(cond)
          dumpz(league, 2)
        end
      end
    end
  end
end

Callers

@/lua/ge/extensions/gameplay/missions/unlocks.lua
    for _, n in ipairs(cond.nested) do
      M.getBranchLevelForCondition(n, list)
    end
    local levelForBranch = {}
    getBranchLevelForCondition(m.startCondition, levelForBranch)
    highestLevelForMission[m.id] = nil