removed old scripts
This commit is contained in:
parent
fea143f2de
commit
37620b4892
@ -1,54 +0,0 @@
|
|||||||
import sqlite3
|
|
||||||
|
|
||||||
# Connect to the SQLite database
|
|
||||||
conn = sqlite3.connect("items.db")
|
|
||||||
cursor = conn.cursor()
|
|
||||||
|
|
||||||
# Drop the existing reloading table if it exists
|
|
||||||
cursor.execute("DROP TABLE IF EXISTS ammo")
|
|
||||||
|
|
||||||
# Create the reloading table with an auto-incremented primary key
|
|
||||||
cursor.execute(
|
|
||||||
"""
|
|
||||||
CREATE TABLE ammo (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
type TEXT,
|
|
||||||
name TEXT,
|
|
||||||
rarity INTEGER,
|
|
||||||
weight REAL,
|
|
||||||
width INTEGER,
|
|
||||||
height INTEGER,
|
|
||||||
stack INTEGER,
|
|
||||||
value INTEGER,
|
|
||||||
gunpowder INTEGER
|
|
||||||
)
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
# id TEXT PRIMARY KEY, type TEXT, name TEXT, rarity INTEGER, weight REAL, width INTEGER, height INTEGER, value INTEGER, stack INTEGER
|
|
||||||
|
|
||||||
# Define your data to insert
|
|
||||||
data_to_insert = [
|
|
||||||
("rifle_ammo", "5.56x45 AP", 4, 0.02646, 1, 1, 7500, 30, 15),
|
|
||||||
("rifle_ammo", "5.56x45 FMJ", 1, 0.02646, 1, 1, 2500, 30, 10),
|
|
||||||
("rifle_ammo", "5.56x45 HP", 2, 0.02646, 1, 1, 5000, 30, 10),
|
|
||||||
("pistol_ammo", "9mm AP", 3, 0.01984, 1, 1, 5000, 45, 12),
|
|
||||||
("pistol_ammo", "9mm FMJ", 1, 0.01984, 1, 1, 2000, 45, 6),
|
|
||||||
("pistol_ammo", "9mm HP", 2, 0.01984, 1, 1, 4000, 45, 6),
|
|
||||||
("pistol_ammo", ".40 S&W AP", 3, 0.01984, 1, 1, 5500, 45, 13),
|
|
||||||
("pistol_ammo", ".40 S&W FMJ", 1, 0.01984, 1, 1, 3000, 45, 7),
|
|
||||||
("pistol_ammo", ".40 S&W HP", 2, 0.01984, 1, 1, 4500, 45, 7),
|
|
||||||
("rifle_ammo", "7.62x39 AP", 4, 0.02646, 1, 1, 5200, 30, 15),
|
|
||||||
("rifle_ammo", "7.62x39 FMJ", 1, 0.02646, 1, 1, 1800, 30, 10),
|
|
||||||
("rifle_ammo", "7.62x39 HP", 2, 0.02646, 1, 1, 3600, 30, 10),
|
|
||||||
]
|
|
||||||
|
|
||||||
# Insert data into the table without specifying the 'id' column
|
|
||||||
for row in data_to_insert:
|
|
||||||
cursor.execute(
|
|
||||||
"INSERT INTO ammo (type, name, rarity, weight, width, height, stack, value, gunpowder) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
||||||
row,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Commit the changes and close the connection
|
|
||||||
conn.commit()
|
|
||||||
conn.close()
|
|
@ -1,50 +0,0 @@
|
|||||||
import sqlite3
|
|
||||||
import csv
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Connect to the SQLite database
|
|
||||||
conn = sqlite3.connect("items.db")
|
|
||||||
cursor = conn.cursor()
|
|
||||||
|
|
||||||
# Drop the existing reloading table if it exists
|
|
||||||
cursor.execute("DROP TABLE IF EXISTS reloading")
|
|
||||||
|
|
||||||
# Create the reloading table with an auto-incremented primary key
|
|
||||||
cursor.execute(
|
|
||||||
"""
|
|
||||||
CREATE TABLE reloading (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
type TEXT,
|
|
||||||
name TEXT,
|
|
||||||
rarity INTEGER,
|
|
||||||
weight REAL,
|
|
||||||
width INTEGER,
|
|
||||||
height INTEGER,
|
|
||||||
stack INTEGER,
|
|
||||||
value INTEGER
|
|
||||||
)
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
# Define the directory where the CSV file is located
|
|
||||||
csv_directory = "data" # Change this to your directory path
|
|
||||||
|
|
||||||
# Define the CSV file name
|
|
||||||
csv_file = "reloading.csv" # Change this to your CSV file name
|
|
||||||
|
|
||||||
# Build the full path to the CSV file
|
|
||||||
csv_path = os.path.join(csv_directory, csv_file)
|
|
||||||
|
|
||||||
# Read data from the CSV file and insert it into the table
|
|
||||||
with open(csv_path, newline="") as csvfile:
|
|
||||||
csv_reader = csv.reader(csvfile)
|
|
||||||
next(csv_reader) # Skip the header row if it exists in the CSV
|
|
||||||
for row in csv_reader:
|
|
||||||
cursor.execute(
|
|
||||||
"INSERT INTO reloading (type, name, rarity, weight, width, height, stack, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
||||||
row,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Commit the changes and close the connection
|
|
||||||
conn.commit()
|
|
||||||
conn.close()
|
|
Loading…
Reference in New Issue
Block a user