From 37620b48922d45fa5caf5aefa7ed1810ae2bb6a1 Mon Sep 17 00:00:00 2001 From: 0ceanSlim <89587889+0ceanSlim@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:20:46 -0400 Subject: [PATCH] removed old scripts --- Database/ammo.py | 54 ---------------------------------------- Database/createtables.py | 0 Database/reloading.py | 50 ------------------------------------- 3 files changed, 104 deletions(-) delete mode 100644 Database/ammo.py delete mode 100644 Database/createtables.py delete mode 100644 Database/reloading.py diff --git a/Database/ammo.py b/Database/ammo.py deleted file mode 100644 index fa3fc886..00000000 --- a/Database/ammo.py +++ /dev/null @@ -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() diff --git a/Database/createtables.py b/Database/createtables.py deleted file mode 100644 index e69de29b..00000000 diff --git a/Database/reloading.py b/Database/reloading.py deleted file mode 100644 index 4cbfffc1..00000000 --- a/Database/reloading.py +++ /dev/null @@ -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()