Add ISAC weapon data management

This commit is contained in:
JB
2026-07-25 00:49:08 -04:00
parent 3f78f0f9d8
commit e528f18d8f
12 changed files with 555 additions and 13 deletions
+70
View File
@@ -165,6 +165,16 @@ CREATE TABLE IF NOT EXISTS talent_description_templates (
template TEXT NOT NULL,
updated_at TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS talent_weapon_scopes (
talent_id TEXT PRIMARY KEY REFERENCES talents(id) ON DELETE CASCADE,
scope TEXT NOT NULL CHECK(scope IN ('Standard', 'Exotic'))
);
INSERT OR IGNORE INTO talent_weapon_scopes(talent_id,scope)
SELECT id,'Standard' FROM talents WHERE category='Weapon';
CREATE TABLE IF NOT EXISTS weapon_talent_slots (
talent_id TEXT PRIMARY KEY REFERENCES talents(id) ON DELETE CASCADE,
slot INTEGER NOT NULL CHECK(slot IN (1, 2))
);
CREATE TABLE IF NOT EXISTS brand_sets (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
@@ -213,3 +223,63 @@ CREATE TABLE IF NOT EXISTS gear_talents (
talent_id TEXT NOT NULL REFERENCES talents(id),
PRIMARY KEY(gear_id, talent_id)
);
CREATE TABLE IF NOT EXISTS weapons (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
category TEXT NOT NULL CHECK(category IN ('Shotgun', 'Rifle', 'MMR', 'AR', 'LMG', 'SMG')),
is_exotic INTEGER NOT NULL DEFAULT 0 CHECK(is_exotic IN (0, 1)),
native_tier INTEGER NOT NULL CHECK(native_tier BETWEEN 0 AND 2),
damage_type TEXT NOT NULL CHECK(damage_type IN ('Blast', 'Pierce', 'Shredding')),
rpm REAL NOT NULL CHECK(rpm >= 0),
magazine REAL NOT NULL CHECK(magazine >= 0),
reload_speed REAL NOT NULL CHECK(reload_speed >= 0),
accuracy REAL NOT NULL CHECK(accuracy >= 0),
stability REAL NOT NULL CHECK(stability >= 0),
exotic_talent_id TEXT REFERENCES talents(id),
active INTEGER NOT NULL DEFAULT 1 CHECK(active IN (0, 1)),
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL,
CHECK(
(is_exotic = 1 AND exotic_talent_id IS NOT NULL)
OR
(is_exotic = 0 AND exotic_talent_id IS NULL)
)
);
CREATE UNIQUE INDEX IF NOT EXISTS weapons_name_nocase_idx ON weapons(name COLLATE NOCASE);
CREATE TABLE IF NOT EXISTS weapon_tier_ranges (
weapon_id TEXT NOT NULL REFERENCES weapons(id) ON DELETE CASCADE,
tier INTEGER NOT NULL CHECK(tier BETWEEN 0 AND 2),
damage_min REAL NOT NULL CHECK(damage_min >= 0),
damage_max REAL NOT NULL CHECK(damage_max >= damage_min),
firepower_min REAL NOT NULL CHECK(firepower_min >= 0),
firepower_max REAL NOT NULL CHECK(firepower_max >= firepower_min),
toughness_min REAL NOT NULL CHECK(toughness_min >= 0),
toughness_max REAL NOT NULL CHECK(toughness_max >= toughness_min),
engineering_min REAL NOT NULL CHECK(engineering_min >= 0),
engineering_max REAL NOT NULL CHECK(engineering_max >= engineering_min),
PRIMARY KEY(weapon_id, tier)
);
CREATE TABLE IF NOT EXISTS weapon_talent_options (
weapon_id TEXT NOT NULL REFERENCES weapons(id) ON DELETE CASCADE,
talent_slot INTEGER NOT NULL CHECK(talent_slot IN (1, 2)),
talent_id TEXT NOT NULL REFERENCES talents(id),
PRIMARY KEY(weapon_id, talent_slot, talent_id)
);
CREATE TABLE IF NOT EXISTS weapon_augmentation_effects (
id TEXT PRIMARY KEY,
weapon_id TEXT NOT NULL REFERENCES weapons(id) ON DELETE CASCADE,
stat_attribute_id TEXT NOT NULL REFERENCES stat_attributes(id),
value REAL NOT NULL CHECK(value > 0),
sort_order INTEGER NOT NULL CHECK(sort_order IN (1, 2)),
UNIQUE(weapon_id, sort_order),
UNIQUE(weapon_id, stat_attribute_id)
);
CREATE TABLE IF NOT EXISTS weapon_base_attribute_bonuses (
id TEXT PRIMARY KEY,
weapon_id TEXT NOT NULL REFERENCES weapons(id) ON DELETE CASCADE,
stat_attribute_id TEXT NOT NULL REFERENCES stat_attributes(id),
value REAL NOT NULL CHECK(value > 0),
sort_order INTEGER NOT NULL CHECK(sort_order >= 1),
UNIQUE(weapon_id, stat_attribute_id),
UNIQUE(weapon_id, sort_order)
);