GE Lua Documentation

Press F to search!

calcBranchLevelFromValue

Definition


-- @/lua/ge/extensions/career/branches.lua:294

local function calcBranchLevelFromValue(val, id)
  local branch = getBranchByPath(id)
  local level = -1
  local curLvlProgress, neededForNext, prevThreshold, nextThreshold = -1, -1, -1, -1

  local levels = branch.levels or {}
  for i, lvl in ipairs(levels) do
    if lvl.requiredValue and  val >= lvl.requiredValue then
      level = i
    end
  end
  if levels[level+1] and levels[level+1].requiredValue then
    prevThreshold = levels[level].requiredValue
    neededForNext = levels[level+1].requiredValue - levels[level].requiredValue
    curLvlProgress = val - levels[level].requiredValue
    nextThreshold = levels[level+1].requiredValue
  end
  return level, curLvlProgress, neededForNext, prevThreshold, nextThreshold

end

Callers

@/lua/ge/extensions/gameplay/missions/progress.lua
      local level, curLvlProgress, neededForNext, prevThreshold, nextThreshold =
        career_branches.calcBranchLevelFromValue(
          career_modules_playerAttributes.getAttributeValue(key),
      local levelAfter, curLvlProgressAfter, neededForNextAfter, prevThresholdAfter, nextThresholdAfter =
        career_branches.calcBranchLevelFromValue(
          career_modules_playerAttributes.getAttributeValue(key) + rewardInfo.total,
@/lua/ge/extensions/career/modules/uiUtils.lua
      local value = career_modules_playerAttributes.getAttributeValue(attKey)
      local level, _, _, min, max = career_branches.calcBranchLevelFromValue(value, br.id)
      table.insert(data.branches, {
@/lua/ge/extensions/career/branches.lua
  local xp = M.getBranchXP(id)
  local level, curLvlProgress, neededForNext, prevThreshold, nextThreshold = calcBranchLevelFromValue(xp, id)
  return {
  local attValue = career_modules_playerAttributes and career_modules_playerAttributes.getAttributeValue(branch.attributeKey) or 0
  return calcBranchLevelFromValue(attValue, id)
end
  local attValue = career_modules_playerAttributes and career_modules_playerAttributes.getAttributeValue(branch.attributeKey) or 0
  return calcBranchLevelFromValue(attValue, pathId)
end
  local attValue = career_modules_playerAttributes and career_modules_playerAttributes.getAttributeValue(branch.attributeKey) or 0
  local level = calcBranchLevelFromValue(attValue, id)
  return branch.levels[level].rewardMultiplier or nil
@/lua/ge/extensions/career/modules/delivery/progress.lua
    if branch.id == "key" then
      local level, curLvlProgress, neededForNext, prevThreshold, nextThreshold = career_branches.calcBranchLevelFromValue(career_modules_playerAttributes.getAttributeValue(key), key)
      aggregateChange[key] = {
@/lua/ge/extensions/career/career.lua
        local brData = deepcopy(career_modules_playerAttributes.getAttribute(attKey) or {value=br.defaultValue or 0})
        brData.level, brData.curLvlProgress, brData.neededForNext = career_branches.calcBranchLevelFromValue(brData.value, br.id)
        brData.id = attKey
          local brData = deepcopy(attData[newAttKey] or attData[attKey] or {value=br.defaultValue or 0})
          brData.level, brData.curLvlProgress, brData.neededForNext = career_branches.calcBranchLevelFromValue(brData.value, br.id)
          brData.id = attKey
@/lua/ge/extensions/career/modules/branches/landing.lua
      local value = career_modules_playerAttributes.getAttributeValue(attKey)
      local level, _, _, min, max = career_branches.calcBranchLevelFromValue(value, skill.id)
      local skData = {
  local value = career_modules_playerAttributes.getAttributeValue(attKey)
  local level, _, _, min, max = career_branches.calcBranchLevelFromValue(value, br.id)
  local branchInfo = {
      local value = career_modules_playerAttributes.getAttributeValue(attKey)
      local level, _, _, min, max = career_branches.calcBranchLevelFromValue(value, subBranch.id)
      local skillInfo = {
      local value = career_modules_playerAttributes.getAttributeValue(attKey)
      local level, _, _, min, max = career_branches.calcBranchLevelFromValue(value, domainBranch.id)
      data.skillInfo = {