Data Database Modding

## \_id Values for Modders

It is recommend to use \_id values for your modded data that are an order of magnitude higher than the existing data in the game data database. For example, if the highest \_id in the ShipComponent table is currently 626, considering using \_id=1000 or \_id=2000 for your new ShipComponents as this will make your mod (and the saved games players create with it) more update-ready.

A mod creator does not need to update their mod's game data database to match the latest version shipped with the baseline of the game. However, if you do decide to update your data database, you may find that we have added a ShipComponent with \_id=627. Starting at a higher order \_id for your mods would remove any chance of a conflict in this case.

## data.db Schema

The game's data dabase (data.db) is a SQLite database that contains all of the read-only run-time data used by Star Traders: Frontiers during gameplay and contains the following tables and schemas.

### Version PRAGMA

The game's data database is version-stamped using a SQLite3 PRAGMA called 'version' which must match the current mod build. To extract the version, run the command '.pragma user\_version' and to write the version, run the command '.pragma user\_version = XXXX' where XXXX is your version ID number (a large six or seven digit number.)

https://sqlite.org/pragma.html#pragma\_user\_version

## Enums

Many tables use enums that can be found here.

### Table CharacterType

```
CREATE TABLE CharacterType (\_id INTEGER PRIMARY KEY, tech INTEGER, name TEXT, HPFactor REAL, HPFactor2 REAL, MPFactor REAL, MPFactor2 REAL, resistanceFactor REAL, toughnessFactor REAL, dodgeFactor REAL, enabled INTEGER, sku INTEGER, shortDesc TEXT, longDesc TEXT);

```

### Table CharacterLevel

```
CREATE TABLE CharacterLevel (\_id INTEGER PRIMARY KEY, xp INTEGER, level INTEGER, skill INTEGER, job INTEGER, talent INTEGER, levelType INTEGER);

```

### Table ShipType

For details on modding ships, see Modding Ships.

```
CREATE TABLE ShipType (\_id INTEGER PRIMARY KEY,shipTypeName TEXT, startShipCost INTEGER, shipCost INTEGER,skeletonDataFile TEXT,atlasFile TEXT, skinName TEXT, skinGroup TEXT, hullPoints INTEGER,baseArmor INTEGER, baseDeflection INTEGER, baseMass INTEGER, baseFuel INTEGER, maxOfficer INTEGER, maxLifeSupport INTEGER, maxCraft INTEGER, maxCraftDefense INTEGER, startingShip INTEGER, factionId INTEGER, gameState INTEGER, unlockId INTEGER, smallSlots INTEGER, mediumSlots INTEGER, largeSlots INTEGER);

```

### Table ShipComponent

```
CREATE TABLE ShipComponent (\_id INTEGER PRIMARY KEY AUTOINCREMENT, componentSize INTEGER, componentType INTEGER, componentName TEXT, componentDesc TEXT, componentPng TEXT, componentLevel INTEGER, shipWeaponId INTEGER, skPilot INTEGER, skShipOps INTEGER, skGunnery INTEGER, skElectronics INTEGER, skNavigation INTEGER, skExplorer INTEGER, holdsCargo INTEGER, holdsCrew INTEGER, holdsOfficer INTEGER, jumpCost INTEGER, armorBonus INTEGER, fuelBonus INTEGER, holdsGuest INTEGER, holdsPrisoner INTEGER, holdsCraft INTEGER, medicalRating INTEGER, shipEffectId INTEGER, deflectionBonus INTEGER, mass INTEGER, shipEngineId INTEGER, driveMass INTEGER, installCost INTEGER, installValue INTEGER, installTime INTEGER, subType INTEGER, signature INTEGER, sortPriority INTEGER, factionId INTEGER, gameState INTEGER, minEcon INTEGER, minMil INTEGER, minStar INTEGER, unlockId INTEGER);

```

### Table ShipWeapon

```
CREATE TABLE ShipWeapon (\_id INTEGER PRIMARY KEY AUTOINCREMENT,weaponType INTEGER,damage INTEGER,damageDice INTEGER,winTies INTEGER, baseToHitCraft INTEGER, range INTEGER, attackType INTEGER, pngPath TEXT,hudPngPath TEXT,sound2 INTEGER,ap INTEGER,sound INTEGER,accuracy INTEGER,priority INTEGER, weaponName TEXT, level INTEGER, critChance INTEGER, effectChance INTEGER, radDamage INTEGER, voidDamage INTEGER);

```

### Table ShipEngine

```
CREATE TABLE ShipEngine(\_id INTEGER PRIMARY KEY AUTOINCREMENT, actionPoints INTEGER, moveCost INTEGER, shipSpeed INTEGER, shipAgile INTEGER, mapFuelCost INTEGER, combatFuelCost INTEGER, designMass INTEGER, safetyRating INTEGER, pngPath TEXT, description TEXT, name TEXT);

```

### Table ShipEffect

```
CREATE TABLE ShipEffect (\_id INTEGER PRIMARY KEY AUTOINCREMENT,effectType INTEGER,boardingBonus INTEGER, rangedAttackBonus INTEGER, damageBonus INTEGER, craftDamageBonus INTEGER,critBonus INTEGER,defensiveBonus INTEGER,armorBonus INTEGER,deflectionBonus INTEGER,reactorBonus INTEGER,moveBonus INTEGER, craftAttackBonus INTEGER, craftDefenseBonus INTEGER, craftMoveStatus INTEGER, radDamage INTEGER, voidDamage INTEGER, dotComponent INTEGER, dotCrew INTEGER, dotMorale INTEGER,radRes INTEGER, voidRes INTEGER,initBonus INTEGER,targetRule INTEGER,escapeBonus INTEGER, cloakBonus INTEGER, hullPoints INTEGER, jumpTime INTEGER, engineSafety INTEGER, patrol INTEGER, blockade INTEGER, spy INTEGER, salvage INTEGER, explorer INTEGER, effectName TEXT,effectDesc TEXT,pngPath TEXT);

```

### Table SmallCraft

```
CREATE TABLE SmallCraft (\_id INTEGER PRIMARY KEY AUTOINCREMENT, maxHull INTEGER, cost INTEGER, craftTypeId INTEGER, shipWeaponId INTEGER, craftArmor INTEGER, craftDeflection INTEGER, launchFuelCost INTEGER, skPilot INTEGER, skElectronics INTEGER, skGunnery INTEGER, baseActionPoints INTEGER, craftAgile INTEGER, craftSpeed INTEGER, repairCost INTEGER, maintCost INTEGER, baseToHitShip INTEGER, baseToHitCraft INTEGER, baseToDodgeHit INTEGER, factionId INTEGER, gameState INTEGER, minRank INTEGER, minEcon INTEGER, minMil INTEGER, minStar INTEGER, unlockId INTEGER, level INTEGER, skeletonDataFile TEXT, atlasFile TEXT, skinName TEXT, pngPath TEXT,description TEXT, craftName TEXT);

```

### Table Weapon

```
CREATE TABLE Weapon (\_id INTEGER PRIMARY KEY,weaponType INTEGER,damage INTEGER,damageDice INTEGER,parry INTEGER,penetration INTEGER,initScore INTEGER, range INTEGER,cost INTEGER,autoBlock INTEGER, mass INTEGER, pngPath TEXT,projectilePngPath TEXT,sound2 INTEGER,groupId INTEGER,sound INTEGER,accuracy INTEGER,effectId INTEGER, weaponName TEXT, level INTEGER, factionId INTEGER);

```

### Table Armor

```
CREATE TABLE Armor( \_id INTEGER PRIMARY KEY, armorType INTEGER,protection INTEGER, absorption INTEGER, hardness INTEGER,dodge INTEGER, initScore INTEGER, effectId INTEGER,cost INTEGER, groupId INTEGER, gearLevel INTEGER, factionId INTEGER, pngPath TEXT,armorName TEXT);

```

### Table Gear

```
CREATE TABLE Gear ( \_id INTEGER PRIMARY KEY, level INTEGER, gearType INTEGER, effectId INTEGER, cost INTEGER, factionId INTEGER, groupId INTEGER, pngPath TEXT, gearName TEXT);

```

### Table JobConfig

```
CREATE TABLE JobConfig(\_id INTEGER PRIMARY KEY AUTOINCREMENT, groupId INTEGER, option1 INTEGER, option2 INTEGER, option3 INTEGER, option4 INTEGER, option5 INTEGER, option6 INTEGER, option7 INTEGER, pngPath TEXT, name TEXT, name2 TEXT, desc TEXT, desc2 TEXT);

```
See Modding Jobs and Professions for full details on how to add, edit or remove Jobs and Professions using the JobConfig table.

### Table Job

```
CREATE TABLE Job (\_id INTEGER PRIMARY KEY AUTOINCREMENT, jobName TEXT, jobType INTEGER, jobLevel INTEGER, skLightFirearms INTEGER, skHeavyFirearms INTEGER, skMelee INTEGER, skEvasion INTEGER, skTactics INTEGER, skStealth INTEGER, skGunnery INTEGER, skPilot INTEGER, skShipOps INTEGER, skRepair INTEGER, skElectronics INTEGER, skNavigation INTEGER, skDoctor INTEGER, skCommand INTEGER, skNegotiate INTEGER, skIntimidate INTEGER, skExplorer INTEGER, enabled INTEGER, sortBy INTEGER);

```
Each Job needs 36 entries, all with the same JobType key and covering jobLevel 1 to 36. Each row indicates the Skill granted by that row.

### Table Trait

```
CREATE TABLE Trait ( \_id INTEGER PRIMARY KEY, traitName TEXT, traitDesc TEXT, characterEffectId INTEGER, traitScore INTEGER, actionType INTEGER, resultType INTEGER, traitGroupId INTEGER, traitGroupId2 INTEGER);

```

### Table Talent

For more details on modding Talents, see Modding Talents.

```
CREATE TABLE Talent (\_id INTEGER PRIMARY KEY,talentType INTEGER,talentLevel INTEGER,useMinPos INTEGER, useMaxPos INTEGER,targetType TEXT,targets INTEGER, minPos INTEGER, maxPos INTEGER, skillType TEXT,actionType INTEGER, resultType INTEGER, reqCraftType INTEGER, talentAccuracy INTEGER,weapon INTEGER,targetEffect INTEGER,targetDuration INTEGER,effect INTEGER,duration INTEGER, posChange INTEGER, targetPosChange INTEGER, heals INTEGER,healsType TEXT, jobType INTEGER, jobLevel INTEGER, sfx INTEGER, cooldown INTEGER, pngPath TEXT, projectilePngPath TEXT, partEffect TEXT,partEffect2 TEXT,talentName2 TEXT,talentName TEXT);

```

### Table Effect

```
CREATE TABLE Effect (\_id INTEGER PRIMARY KEY AUTOINCREMENT,effectType INTEGER,attackBonus INTEGER, rangedAttackBonus INTEGER, damageBonus INTEGER, damageMelee INTEGER, critBonus INTEGER,defensiveBonus INTEGER,armorBonus INTEGER,dodgeBonus INTEGER,stealthBonus INTEGER,initBonus INTEGER,fire INTEGER, plasma INTEGER, rad INTEGER, poison INTEGER, bleed INTEGER, fireRes INTEGER, plasmaRes INTEGER, radRes INTEGER, poisonRes INTEGER, bleedRes INTEGER, stunned INTEGER, pinned INTEGER, attQuickness INTEGER, attStrength INTEGER, attFortitude INTEGER, attWisdom INTEGER, attCharisma INTEGER, attResilience INTEGER, penBonus INTEGER, hardBonus INTEGER, purgeChance INTEGER, maintPointAvoid INTEGER, craftAttackBonus INTEGER, craftDefenseBonus INTEGER, moraleCode INTEGER, effectName TEXT,effectDesc TEXT,pngPath TEXT);

```

### Table QuestLog2

```
CREATE TABLE QuestLog2(\_id INTEGER PRIMARY KEY AUTOINCREMENT, preState INTEGER, storyTypeId INTEGER, storyId INTEGER, title TEXT, desc TEXT);

```

### Table Block2

```
CREATE TABLE Block2 (\_id INTEGER PRIMARY KEY AUTOINCREMENT, blockName TEXT, preState1 INTEGER, preState2 INTEGER, preState3 INTEGER, preHasCharacter INTEGER, preHasContact INTEGER, preHasOfficerSpace INTEGER, preHasGold INTEGER, preItem1 INTEGER, preItem1Type INTEGER, preItem1Num INTEGER, preCode1 INTEGER, preCodeArg1 INTEGER, preFactionRep INTEGER, preContactRep INTEGER, preContactInfluence INTEGER, preRank INTEGER, preEdict INTEGER, preHasSKU INTEGER, preDevOnly INTEGER, preDialogId INTEGER, preOnFailDelete INTEGER, eventType TEXT, eventId INTEGER, postState1 INTEGER, postState2 INTEGER, postState3 INTEGER, postCode1 INTEGER, postCodeArg1 INTEGER, postCode2 INTEGER, postCodeArg2 INTEGER, postItem1 INTEGER, postItem1Type INTEGER, postItem1Num INTEGER, postItem2 INTEGER, postItem2Type INTEGER, postItem2Num INTEGER, postGrantExp INTEGER, postGold INTEGER, postDeleteChar INTEGER, postDeleteContact INTEGER, postKnowContact INTEGER, postFactionRep INTEGER, postContactRep INTEGER, postContactInfluence INTEGER, postBlock1Type INTEGER, postBlock1Turns INTEGER, postBlock1Id INTEGER, postBlock1StoryId INTEGER, postUseTurns INTEGER, postDeleteGameBlock INTEGER, postQuestState1 INTEGER, postQuestState2 INTEGER, postQuestState3 INTEGER, postSetScore INTEGER, postLogEntry TEXT);

```

### Table Dialog2

```
CREATE TABLE Dialog2(\_id INTEGER PRIMARY KEY, groupId INTEGER, useContactFace INTEGER, useCharacterFace INTEGER, useCrewFace INTEGER, useDefaultFace INTEGER, stateRequired INTEGER, stateExcluded INTEGER, font INTEGER, charRequiredFlag INTEGER, pngPath TEXT, pngTitle TEXT, diagText TEXT);

```

### Table BlockCrewCombat

```
CREATE TABLE BlockCrewCombat (\_id INTEGER PRIMARY KEY AUTOINCREMENT, crewTypeId INTEGER, factionId INTEGER, challengeLevelBonus INTEGER, storyId INTEGER, preBlockId INTEGER, winBlockId INTEGER, lossBlockId INTEGER);

```

### Table BlockShipCombat

```
CREATE TABLE BlockShipCombat(\_id INTEGER PRIMARY KEY AUTOINCREMENT, shipAiType INTEGER, factionId INTEGER, challengeLevelBonus INTEGER, preBlockId INTEGER, winBlockId INTEGER, lossBlockId INTEGER, drawBlockId INTEGER, storyId INTEGER, immediateCombat INTEGER, captainGender INTEGER, shipName TEXT, captainName TEXT);

```

### Table Contact

```
CREATE TABLE Contact (\_id INTEGER PRIMARY KEY AUTOINCREMENT, typeName TEXT, description TEXT, defaultFaceId INTEGER, offerMission INTEGER, offerRank INTEGER, offerPermit INTEGER, offerEdict INTEGER, offerMarket INTEGER, offerRecruit INTEGER, offerService INTEGER, offerBuyRumor INTEGER, offerBuyData INTEGER, offerPardon INTEGER, offerDiscount INTEGER, minRep INTEGER, notWanted INTEGER, startingContact INTEGER, zoneTypeHint INTEGER, baseInfluence INTEGER, unlockId INTEGER, powerLevel INTEGER);

```

### Table ContactTrait

```
CREATE TABLE ContactTrait ( \_id INTEGER PRIMARY KEY, name TEXT, traitDesc TEXT, traitIcon TEXT, traitGroupId INTEGER, traitScore INTEGER);

```

### Table ResourcesByResource

```
CREATE TABLE ResourcesByResource (\_id INTEGER PRIMARY KEY AUTOINCREMENT, popEcon INTEGER, farmEcon INTEGER, mineEcon INTEGER, refineEcon INTEGER, industEcon INTEGER, orbitalEcon INTEGER, luxEcon INTEGER, SmuggEcon INTEGER, legal INTEGER, permit INTEGER);

```

### Table Backer

```
CREATE TABLE Backer (\_id INTEGER PRIMARY KEY, displayName TEXT, accountcode TEXT, featurecode INTEGER);

```

### Table ShipDataCompartment

```
CREATE TABLE ShipDataCompartment(\_id INTEGER PRIMARY KEY AUTOINCREMENT, shipId INTEGER, tmxId INTEGER, size INTEGER, componentType INTEGER, defaultComponent INTEGER, typeLocked INTEGER);

```

### Table ShipTypeAiRoller

```
CREATE TABLE ShipTypeAiRoller (\_id INTEGER PRIMARY KEY AUTOINCREMENT, aiTypeId INTEGER, shipTypeId INTEGER, minChallengeLevel INTEGER, rollerWeight INTEGER, factionId INTEGER, patternTypeId INTEGER);

```

### Generated Tables

Some tables contain data that must be generated from other assets:

* RegionMapData
* RegionMapGate
* RegionMapWorld