From 2ac0f307ddeb67c193e8b935039fa90ff4355f01 Mon Sep 17 00:00:00 2001 From: 0ceanSlim <89587889+0ceanSlim@users.noreply.github.com> Date: Mon, 4 Sep 2023 12:18:57 -0400 Subject: [PATCH] working python scripts for adding new tables and items to database --- Database/ammo.py | 54 ++++++++++++++++ Database/items.db | Bin 0 -> 77824 bytes Database/reloading.py | 54 ++++++++++++++++ Database/tables.py | 147 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 Database/ammo.py create mode 100644 Database/items.db create mode 100644 Database/reloading.py create mode 100644 Database/tables.py diff --git a/Database/ammo.py b/Database/ammo.py new file mode 100644 index 00000000..fa3fc886 --- /dev/null +++ b/Database/ammo.py @@ -0,0 +1,54 @@ +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/items.db b/Database/items.db new file mode 100644 index 0000000000000000000000000000000000000000..c6af7fcd1648331cf452b457228be43e9bfa705a GIT binary patch literal 77824 zcmeI)Z)_7~90%~bYuD?)d!CI^j)B{5;usz4wr=aj6rE$4fH0_|21yLFY&R&h8?+r@ zG$v!jEJlfch`xYC5)Fw)4eua^Hzq{iDIp=jgh+xUXhJYXH2A{A=egc>*U=5%psswI z+^^4`{`Ty7KKDG^J-cq(p4*(r>e}ddIu*}q?LxUAio(;HCI~_^J1W`XWQWL(I*01?>p|Zo@4Sy?$=$f$a~4@vYpOI z+0Oelh}R+TUkDtjS7kL25RZnk@m)zho=T1LL+Tss?~V0qvEFr?`!!ypt@3K-BQc_F z+!E_w-#@5D2R9D%4(`x4_3zMnpO0wClQ$9QU@_t>5^}k@N8jGi9SEb|W zMD}H?-I>omq$hUo$!e@On{Abek?fv(bNA$O&A!c~XR`6(efOpxj3*~_tJ>)9k(E_B zjFyKRV}@?`#Mu7vLnC^+z$tiS*-}}ptrd?t45+l89FLDA#&+imj)M7&f_-K0cALmlqWf*DB zq-nEw2wtg5Owr5NMiA5Uj9M(`I17*z|4An13gPpWef z7y}v#8&Aq)%u_H4^muwVJG=!1y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