added craft.csv but id is not updating and stack and value are reversed

This commit is contained in:
0ceanSlim 2023-09-04 17:52:41 -04:00
parent 9053ece28e
commit 69aa59f9ce
5 changed files with 96 additions and 17 deletions

View File

@ -39,5 +39,22 @@ cursor.execute(
"""
)
# Define the table schema for ammo
cursor.execute(
"""
CREATE TABLE IF NOT EXISTS craft (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT,
name TEXT,
rarity INTEGER,
weight REAL,
width INTEGER,
height INTEGER,
stack INTEGER,
value INTEGER
)
"""
)
# Close the connection
conn.close()

View File

@ -1,14 +1,14 @@
id,type,name,rarity,weight,width,height,stack,value,gunpowder
NULL,rifle_ammo,5.56x45 AP,4,0.02646,1,1,7500,30,15
NULL,rifle_ammo,5.56x45 FMJ,1,0.02646,1,1,2500,30,10
NULL,rifle_ammo,5.56x45 HP,2,0.02646,1,1,5000,30,10
NULL,pistol_ammo,9mm AP,3,0.01984,1,1,5000,45,12
NULL,pistol_ammo,9mm FMJ,1,0.01984,1,1,2000,45,6
NULL,pistol_ammo,9mm HP,2,0.01984,1,1,4000,45,6
NULL,pistol_ammo,.40 S&W AP,3,0.01984,1,1,5500,45,13
NULL,pistol_ammo,.40 S&W FMJ,1,0.01984,1,1,3000,45,7
NULL,pistol_ammo,.40 S&W HP,2,0.01984,1,1,4500,45,7
NULL,rifle_ammo,7.62x39 AP,4,0.02646,1,1,5200,30,15
NULL,rifle_ammo,7.62x39 FMJ,1,0.02646,1,1,1800,30,10
NULL,rifle_ammo,7.62x39 HP,2,0.02646,1,1,3600,30,10
NULL,rifle_ammo,27.62x39 HP,2,0.02646,1,1,3600,30,10
NULL,rifle_ammo,5.56x45 AP,4,0.02646,1,1,30,7500,15
NULL,rifle_ammo,5.56x45 FMJ,1,0.02646,1,1,30,2500,10
NULL,rifle_ammo,5.56x45 HP,2,0.02646,1,1,30,5000,10
NULL,pistol_ammo,9mm AP,3,0.01984,1,1,45,5000,12
NULL,pistol_ammo,9mm FMJ,1,0.01984,1,1,45,2000,6
NULL,pistol_ammo,9mm HP,2,0.01984,1,1,45,4000,6
NULL,pistol_ammo,.40 S&W AP,3,0.01984,1,1,45,5500,13
NULL,pistol_ammo,.40 S&W FMJ,1,0.01984,1,1,45,3000,7
NULL,pistol_ammo,.40 S&W HP,2,0.01984,1,1,45,4500,7
NULL,rifle_ammo,7.62x39 AP,4,0.02646,1,1,30,5200,15
NULL,rifle_ammo,7.62x39 FMJ,1,0.02646,1,1,30,1800,10
NULL,rifle_ammo,7.62x39 HP,2,0.02646,1,1,30,3600,10
NULL,rifle_ammo,27.62x39 HP,2,0.02646,1,1,30,3600,10

1 id type name rarity weight width height stack value gunpowder
2 NULL rifle_ammo 5.56x45 AP 4 0.02646 1 1 7500 30 30 7500 15
3 NULL rifle_ammo 5.56x45 FMJ 1 0.02646 1 1 2500 30 30 2500 10
4 NULL rifle_ammo 5.56x45 HP 2 0.02646 1 1 5000 30 30 5000 10
5 NULL pistol_ammo 9mm AP 3 0.01984 1 1 5000 45 45 5000 12
6 NULL pistol_ammo 9mm FMJ 1 0.01984 1 1 2000 45 45 2000 6
7 NULL pistol_ammo 9mm HP 2 0.01984 1 1 4000 45 45 4000 6
8 NULL pistol_ammo .40 S&W AP 3 0.01984 1 1 5500 45 45 5500 13
9 NULL pistol_ammo .40 S&W FMJ 1 0.01984 1 1 3000 45 45 3000 7
10 NULL pistol_ammo .40 S&W HP 2 0.01984 1 1 4500 45 45 4500 7
11 NULL rifle_ammo 7.62x39 AP 4 0.02646 1 1 5200 30 30 5200 15
12 NULL rifle_ammo 7.62x39 FMJ 1 0.02646 1 1 1800 30 30 1800 10
13 NULL rifle_ammo 7.62x39 HP 2 0.02646 1 1 3600 30 30 3600 10
14 NULL rifle_ammo 27.62x39 HP 2 0.02646 1 1 3600 30 30 3600 10

52
Database/data/craft.csv Normal file
View File

@ -0,0 +1,52 @@
id,type,name,rarity,weight,width,height,stack,value
NULL,Basic Materials,Coal,2,0.02100,1,1,5,2500
NULL,Basic Materials,Wood,1,0.02100,1,1,20,1000
NULL,Basic Materials,Leather,2,0.25000,1,1,2,20000
NULL,Basic Materials,Cloth,1,0.03086,1,1,5,5000
NULL,Basic Materials,Plastic,1,0.22046,1,1,10,600
NULL,Basic Materials,Thread,1,0.00772,1,1,20,250
NULL,Basic Materials,Acid,1,0.02100,1,1,10,2500
NULL,Basic Materials,Adhesive,2,0.03969,1,1,10,6000
NULL,Basic Materials,Antiseptic,2,0.03969,1,1,2,5000
NULL,Basic Materials,Oil,2,0.06857,1,1,10,5000
NULL,Basic Materials,Steel,1,0.06857,1,1,20,300
NULL,Basic Materials,Copper,2,0.06857,1,1,10,2000
NULL,Basic Materials,Zinc,1,0.06857,1,1,10,400
NULL,Basic Materials,Lead,2,0.34286,1,1,5,1500
NULL,Basic Materials,Aluminum,2,0.06857,1,1,10,1200
NULL,Basic Materials,Gold Scrap,5,0.06857,1,1,10,250000
NULL,Basic Materials,Silver Scrap,4,0.06857,1,1,10,50000
NULL,Basic Materials,Glass,1,0.03969,1,1,10,1000
NULL,Basic Materials,Ceramic,2,0.22046,1,1,10,1000
NULL,Tools,Hammer,1,1.25000,1,2,1,75000
NULL,Tools,Flathead Screwdriver,1,0.33069,1,1,2,25000
NULL,Tools,Phillip Head Screwdriver,1,0.33069,1,1,2,25000
NULL,Tools,Set of Wrenches,3,3.00000,2,2,4,165000
NULL,Tools,Large Pliers,1,0.33069,1,1,1,25000
NULL,Tools,Needle Nose Pliers,1,0.33069,1,1,1,25000
NULL,Tools,Measuring Tape,1,0.33069,1,1,1,40000
NULL,Tools,Lock Pick,2,0.05000,1,1,5,50000
NULL,Tools,Drill,3,4.00000,2,2,4,225000
NULL,Tools,Multi-Tool,4,0.25000,1,1,1,400000
NULL,Tools,Roll Pin Punch Set,3,3.00000,2,2,4,120000
NULL,Tools,Set of Files,3,2.00000,2,2,4,200000
NULL,Tools,Rotary Tool,3,1.50000,1,2,2,180000
NULL,Tools,Bench Vise,3,30.00000,2,2,4,350000
NULL,Tools,Scissors,1,0.20000,2,1,2,35000
NULL,Tools,Set of sockets,3,3.12500,2,1,2,50000
NULL,Tools,Socket,1,0.31250,1,1,10,5000
NULL,Tools,Wrench,1,0.60000,1,2,2,33000
NULL,Tools,File,1,0.40000,1,2,2,40000
NULL,Tools,Ratchet,2,1.00000,1,2,2,25000
NULL,Tools,Needle,1,0.01544,1,1,10,200
NULL,Advanced Materials,Brass,3,0.06857,1,1,10,2500
NULL,Advanced Materials,Tape,2,0.11023,1,1,1,5000
NULL,Advanced Materials,Ballistic Fiber,3,0.57500,1,1,2,25000
NULL,Advanced Materials,Circuitry,3,0.22046,1,1,10,20000
NULL,Advanced Materials,Springs,3,0.07938,1,1,5,10000
NULL,Advanced Materials,Screws,3,0.07938,1,1,10,5000
NULL,Advanced Materials,Gears,3,0.07938,1,1,5,8000
NULL,Advanced Materials,Rubber,1,0.22046,1,1,10,5600
NULL,Junk,Car Battery,3,35.00000,3,2,6,500000
NULL,Junk,Pre-War Money,3,0.00050,1,1,100,5000
NULL,Junk,Syringe,2,0.22046,1,1,1,7500
1 id type name rarity weight width height stack value
2 NULL Basic Materials Coal 2 0.02100 1 1 5 2500
3 NULL Basic Materials Wood 1 0.02100 1 1 20 1000
4 NULL Basic Materials Leather 2 0.25000 1 1 2 20000
5 NULL Basic Materials Cloth 1 0.03086 1 1 5 5000
6 NULL Basic Materials Plastic 1 0.22046 1 1 10 600
7 NULL Basic Materials Thread 1 0.00772 1 1 20 250
8 NULL Basic Materials Acid 1 0.02100 1 1 10 2500
9 NULL Basic Materials Adhesive 2 0.03969 1 1 10 6000
10 NULL Basic Materials Antiseptic 2 0.03969 1 1 2 5000
11 NULL Basic Materials Oil 2 0.06857 1 1 10 5000
12 NULL Basic Materials Steel 1 0.06857 1 1 20 300
13 NULL Basic Materials Copper 2 0.06857 1 1 10 2000
14 NULL Basic Materials Zinc 1 0.06857 1 1 10 400
15 NULL Basic Materials Lead 2 0.34286 1 1 5 1500
16 NULL Basic Materials Aluminum 2 0.06857 1 1 10 1200
17 NULL Basic Materials Gold Scrap 5 0.06857 1 1 10 250000
18 NULL Basic Materials Silver Scrap 4 0.06857 1 1 10 50000
19 NULL Basic Materials Glass 1 0.03969 1 1 10 1000
20 NULL Basic Materials Ceramic 2 0.22046 1 1 10 1000
21 NULL Tools Hammer 1 1.25000 1 2 1 75000
22 NULL Tools Flathead Screwdriver 1 0.33069 1 1 2 25000
23 NULL Tools Phillip Head Screwdriver 1 0.33069 1 1 2 25000
24 NULL Tools Set of Wrenches 3 3.00000 2 2 4 165000
25 NULL Tools Large Pliers 1 0.33069 1 1 1 25000
26 NULL Tools Needle Nose Pliers 1 0.33069 1 1 1 25000
27 NULL Tools Measuring Tape 1 0.33069 1 1 1 40000
28 NULL Tools Lock Pick 2 0.05000 1 1 5 50000
29 NULL Tools Drill 3 4.00000 2 2 4 225000
30 NULL Tools Multi-Tool 4 0.25000 1 1 1 400000
31 NULL Tools Roll Pin Punch Set 3 3.00000 2 2 4 120000
32 NULL Tools Set of Files 3 2.00000 2 2 4 200000
33 NULL Tools Rotary Tool 3 1.50000 1 2 2 180000
34 NULL Tools Bench Vise 3 30.00000 2 2 4 350000
35 NULL Tools Scissors 1 0.20000 2 1 2 35000
36 NULL Tools Set of sockets 3 3.12500 2 1 2 50000
37 NULL Tools Socket 1 0.31250 1 1 10 5000
38 NULL Tools Wrench 1 0.60000 1 2 2 33000
39 NULL Tools File 1 0.40000 1 2 2 40000
40 NULL Tools Ratchet 2 1.00000 1 2 2 25000
41 NULL Tools Needle 1 0.01544 1 1 10 200
42 NULL Advanced Materials Brass 3 0.06857 1 1 10 2500
43 NULL Advanced Materials Tape 2 0.11023 1 1 1 5000
44 NULL Advanced Materials Ballistic Fiber 3 0.57500 1 1 2 25000
45 NULL Advanced Materials Circuitry 3 0.22046 1 1 10 20000
46 NULL Advanced Materials Springs 3 0.07938 1 1 5 10000
47 NULL Advanced Materials Screws 3 0.07938 1 1 10 5000
48 NULL Advanced Materials Gears 3 0.07938 1 1 5 8000
49 NULL Advanced Materials Rubber 1 0.22046 1 1 10 5600
50 NULL Junk Car Battery 3 35.00000 3 2 6 500000
51 NULL Junk Pre-War Money 3 0.00050 1 1 100 5000
52 NULL Junk Syringe 2 0.22046 1 1 1 7500

View File

@ -10,20 +10,24 @@ cursor = conn.cursor()
csv_directory = "data" # Change this to your directory path
# Define the CSV file names
csv_file_reloading = "reloading.csv" # Change this to your reloading CSV file name
csv_file_ammo = "ammo.csv" # Change this to your new_table CSV file name
csv_file_reloading = "reloading.csv"
csv_file_ammo = "ammo.csv"
csv_file_craft = "craft.csv"
# Build the full paths to the CSV files
csv_path_reloading = os.path.join(csv_directory, csv_file_reloading)
csv_path_ammo = os.path.join(csv_directory, csv_file_ammo)
csv_path_craft = os.path.join(csv_directory, csv_file_craft)
# Define the starting ID values for each table
starting_id_reloading = 20000 # Replace with your desired starting value
starting_id_ammo = 10000 # Replace with your desired starting value
starting_id_reloading = 20000
starting_id_ammo = 10000
starting_id_craft = 30000
# Set the starting ID values for each table using INSERT statements
cursor.execute(f"INSERT INTO reloading (id) VALUES ({starting_id_reloading})")
cursor.execute(f"INSERT INTO ammo (id) VALUES ({starting_id_ammo})")
cursor.execute(f"INSERT INTO craft (id) VALUES ({starting_id_craft})")
# Reset the ID sequences for all tables
cursor.execute("DELETE FROM SQLITE_SEQUENCE")
@ -33,6 +37,9 @@ cursor.execute(
cursor.execute(
f"INSERT INTO SQLITE_SEQUENCE (name, seq) VALUES ('ammo', {starting_id_ammo})"
)
cursor.execute(
f"INSERT INTO SQLITE_SEQUENCE (name, seq) VALUES ('craft', {starting_id_craft})"
)
# Function to load data from a CSV file into a table
@ -58,6 +65,9 @@ load_csv_data(csv_path_reloading, "reloading", cursor)
# Load data from the ammo CSV file into the ammo table
load_csv_data(csv_path_ammo, "ammo", cursor)
# Load data from the ammo CSV file into the ammo table
load_csv_data(csv_path_craft, "craft", cursor)
# Commit the changes and close the connection
conn.commit()
conn.close()

Binary file not shown.