Formula

CommonFun.calcPetAdventure_EnchantEfficiency

function CommonFun.calcPetAdventure_EnchantEfficiency(srcUser)
  local scores = 0
  for i = 1, #AllEquipSites do
    local attrs = srcUser:GetEnchantAttrsBySite(AllEquipSites[i])
    if attrs then
      for j = 1, #attrs do
        local attrType = attrs[j].typekey
        local attrValue = attrs[j].propVO.isPercent and attrs[j].value / 100 or attrs[j].value
        local configValue = enchantScore[attrType]
        if configValue then
          local cellValue = attrValue / configValue.maxattr >= 0.8 and attrValue / configValue.maxattr * configValue.allscore or 0
          scores = scores + cellValue
        end
      end
    end
    local combineEff = srcUser:GetCombineEffectsBySite(AllEquipSites[i])
    if combineEff then
      for j = 1, #combineEff do
        local buffid = combineEff[j].buffid
        if buffid then
          local buffLv = buffid % 10
          if enchantgroupScore[buffLv] then
            scores = scores + enchantgroupScore[buffLv]
          end
        end
      end
    end
  end
  isMax = 3000 <= scores
  scores = math.min(scores, 3000)
  return scores / 10000, isMax
end