Filter skins to not add default gloves skins as they do not exist
This commit is contained in:
16
skins.py
16
skins.py
@@ -18,7 +18,7 @@ cur = conn.cursor()
|
||||
|
||||
cur.execute("SELECT * FROM weapons")
|
||||
raw_weapons = cur.fetchall()
|
||||
weapons = {weapon[1]: weapon[0] for weapon in raw_weapons}
|
||||
weapons = {weapon[1]: weapon for weapon in raw_weapons}
|
||||
|
||||
cur.execute("SELECT * FROM rarity")
|
||||
raw_rarity = cur.fetchall()
|
||||
@@ -34,7 +34,7 @@ for raw in content:
|
||||
continue
|
||||
|
||||
skin = {
|
||||
"weapon": weapons[raw["weapon"]["id"]],
|
||||
"weapon": weapons[raw["weapon"]["id"]][0],
|
||||
"rarity": rarity[raw["rarity"]["name"]],
|
||||
"paint_index": raw["paint_index"],
|
||||
"display": raw["pattern"]["name"],
|
||||
@@ -44,9 +44,13 @@ for raw in content:
|
||||
}
|
||||
skins.append(skin)
|
||||
|
||||
for weapon in weapons.keys():
|
||||
for weapon in weapons.values():
|
||||
if weapon[4] == "Gloves":
|
||||
print("skip")
|
||||
continue
|
||||
|
||||
skin = {
|
||||
"weapon": weapons[weapon],
|
||||
"weapon": weapon[0],
|
||||
"rarity": rarity["Stock"],
|
||||
"paint_index": 0,
|
||||
"display": "",
|
||||
@@ -56,8 +60,8 @@ for weapon in weapons.keys():
|
||||
}
|
||||
skins.append(skin)
|
||||
|
||||
for skin in skins:
|
||||
cur.execute("INSERT INTO skins (weapon, rarity, paint_index, display, min_float, max_float, legacy) VALUES (%s, %s, %s, %s, %s, %s, %s)", (skin["weapon"], skin["rarity"], skin["paint_index"], skin["display"], skin["min_float"], skin["max_float"], skin["legacy"]))
|
||||
#for skin in skins:
|
||||
# cur.execute("INSERT INTO skins (weapon, rarity, paint_index, display, min_float, max_float, legacy) VALUES (%s, %s, %s, %s, %s, %s, %s)", (skin["weapon"], skin["rarity"], skin["paint_index"], skin["display"], skin["min_float"], skin["max_float"], skin["legacy"]))
|
||||
|
||||
conn.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user