API ReferenceGE Extensionscareermodules
Career Value Calculator Module
M.dependencies = {'career_career'}
Dependencies
M.dependencies = {'career_career'}Calculates vehicle and part monetary values based on age, mileage, damage, modifications, and primer state. Central to selling, insurance, and repair cost calculations.
Public API
| Function | Signature | Description |
|---|---|---|
M.getInventoryVehicleValue | (inventoryId, ignoreDamage) → number | Full vehicle value including mods, mileage, damage |
M.getPartValue | (part) → number | Single part value adjusted for age, mileage, primer, repairs |
M.getAdjustedVehicleBaseValue | (value, condition) → number | Base value adjusted for age + mileage depreciation |
M.getVehicleMileageById | (inventoryId) → number | Odometer reading for a vehicle |
M.getBrokenPartsThreshold | () → number | Returns 3 (broken parts needed to flag vehicle for repair) |
M.getRepairDetails | (invVehInfo) → table | Repair cost, time, and part count for damaged vehicle |
M.getNumberOfBrokenParts | (partConditions) → number | Count of parts with integrityValue == 0 |
M.partConditionsNeedRepair | (partConditions) → bool | Whether broken parts ≥ threshold (3) |
M.getPartDifference | (originalParts, newParts, changedSlots) → added, removed | Diff between original and current part configurations |
Dependencies
career_career(required)career_modules_inventory- vehicle data accesscareer_modules_partInventory- part lookups for value calculations
Depreciation Model
Age Depreciation
96-entry table depreciationByYear - early years lose value, later years appreciate:
| Years | Annual Change |
|---|---|
| 1 | -20% |
| 2 | -15% |
| 3-4 | -10% |
| 5 | -7% |
| 10 | -3% |
| 23 | -0.5% |
| 24-25 | 0% (floor) |
| 26+ | +0.5% to +2.5% (classic appreciation) |
Mileage Depreciation
lossPerKmRelative = 0.0000025
valueLoss = baseValue × (mileage/1000) × lossPerKmRelativeScrap Value Floor
scrapValueRelative = 0.05 (5% of age-adjusted value)Part Value Modifiers
- Primer: -5% value
- Repair count:
-value × (repairCount / (repairCount + 1)) × 0.2
Vehicle Value Formula
adjustedBase = getValueByAge(configBaseValue, age)
- mileageLoss + scrapFloor
+ Σ(added parts × 0.5 × partValue)
- Σ(removed parts × 0.5 × partValue)
- repairCost (unless ignoreDamage)
minimum = min(500, configBaseValue × 0.05)Damage / Repair
- Broken part:
integrityValue == 0 - Threshold: 3 broken parts → vehicle "needs repair"
- Repair time: 20 seconds per broken part
- Repair cost:
part.value × 0.6per broken part - Exceptions (not blocking): bumper, door, mirror, fascia
Usage Example
-- Get vehicle sell value
local value = career_modules_valueCalculator.getInventoryVehicleValue(inventoryId)
-- Check if vehicle needs repair
local needsRepair = career_modules_valueCalculator.partConditionsNeedRepair(vehicle.partConditions)
-- Get part value for selling
local partValue = career_modules_valueCalculator.getPartValue(part)See Also
- partInventory - Part data and selling
- playerAttributes - Money from sales
- painting - Primer state affects value