Initial commit

This commit is contained in:
Teriuihi 2024-07-05 17:19:50 +02:00
commit 277929ac4e

209
config_creator_v2.py Normal file
View File

@ -0,0 +1,209 @@
import numpy as np
import pandas as pd
import math
import sys
import os
print(os.getcwd())
# Ctrl-Alt-N to run code in VSCode
rarity = {'Legendary': '&6', 'Epic': '&d',
'Rare': '&3', 'Uncommon': '&a', 'Common': '&f', 'Quest': '&c', 'Grove Staff': '#f558b4', 'Admin Staff': '&4'}
rarity_sub = {'Legendary': '&c', 'Epic': '&5',
'Rare': '&9', 'Uncommon': '&2', 'Common': '&7', 'Quest': '&7', 'Grove Staff': '#f50a93', 'Admin Staff': '&c'}
# Replace filename with whatever the downloaded entry form sheet is called
filename = 'ItemEntry.csv'
df = pd.DataFrame()
df = pd.read_csv(filename)
df.drop_duplicates(subset=['Item Name', 'Item Lore',
'What Crate is this Item meant for?'])
# New header line
df.columns = ['timestamp', 'rarity', 'name', 'lore', 'itemtype', 'ARROW_DAMAGE', 'ARROW_FIRE', 'ARROW_INFINITE', 'ARROW_KNOCKBACK', 'BINDING_CURSE', 'CHANNELING', 'DAMAGE_ALL', 'DAMAGE_ARTHROPODS', 'DAMAGE_UNDEAD', 'DEPTH_STRIDER', 'DIG_SPEED', 'DURABILITY', 'FIRE_ASPECT', 'FROST_WALKER', 'IMPALING', 'KNOCKBACK', 'LOOT_BONUS_BLOCKS', 'LOOT_BONUS_MOBS',
'LOYALTY', 'LUCK', 'LURE', 'MENDING', 'MULTISHOT', 'OXYGEN', 'PIERCING', 'PROTECTION_ENVIRONMENTAL', 'PROTECTION_EXPLOSIONS', 'PROTECTION_FALL', 'PROTECTION_FIRE', 'PROTECTION_PROJECTILE', 'QUICK_CHARGE', 'RIPTIDE', 'SILK_TOUCH', 'SOUL_SPEED', 'SWEEPING_EDGE', 'SWIFT_SNEAK', 'THORNS', 'VANISHING_CURSE', 'WATER_WORKER', 'crate', 'seasonal', 'seasonaltype', 'amount', 'trim', 'trimtype', 'trimmat']
df = df.replace(np.nan, '')
print(df)
daily = df[df["crate"] == "Daily Crate"]
weekly = df[df["crate"] == "Weekly Crate"]
quest = df[df["crate"] == "Quest Crate"]
# Write Header (Daily Crate)
with open('tdvc.yml', 'w') as f:
f.write("Crate:\n CrateType: CSGO\n CrateName: '&e&lDaily Vote Crate'\n Preview-Name: '&e&lDaily Vote Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 13\n OpeningBroadCast: False\n BroadCast: '&e* %Player% &eis opening a &6Daily Vote Crate&e! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: '&eDaily Vote Crate'\n Lore:\n - '&7This crate contains strange objects.'\n - '&7You have &6%Keys% keys &7to open this crate with.'\n - '&7&l(&e&l!&7&l) Right click to view rewards.'\n")
f.write(" PhysicalKey:\n Name: '&cDaily Vote Crate Key'\n Lore:\n - '&7Vote on 5 sites every day!'\n - '&7Unlock this crate at spawn.'\n Item: 'TRIPWIRE_HOOK'\n Glowing: True\n Prizes:\n")
# Prizes
for index, row in daily.iterrows():
f.write(" " + str(index + 1) + ":\n")
if row['name'] == '':
f.write(" DisplayName: ''\n")
else:
f.write(" DisplayName: '" +
str(rarity[row['rarity']]) + row['name'].replace("'", "''") + "'\n")
f.write(" DisplayItem: '" + row['itemtype'] + "'\n")
if row['trim'] == 'Yes':
f.write(" DisplayTrim:\n Material: '" + row['trimmat'] + "'\n Pattern: '" + row['trimtype'] + "'\n")
if row['name'] == '':
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win some " + row['itemtype'].lower().replace("_", " ").title() + "'\n")
else:
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win the " + row['name'].replace("'", "''") + "'\n")
f.write(" MaxRange: 75\n Chance: 1\n Firework: false\n Glowing: false\n Player: ''\n Unbreakable: false\n Items:\n - 'Item:" + row['itemtype'] + ", Amount:" +
str(int(row['amount'])))
if row['trim'] == 'Yes':
f.write(", Trim-Material:" + row['trimmat'] + ", Trim-Pattern:" + row['trimtype'])
if row['name'] == '':
f.write("")
else:
f.write(", Name:" + str(rarity[row['rarity']]) + row['name'].replace("'", "''") + ", Lore:")
if row['name'] == '':
f.write("")
else:
if "," in row['lore']:
f.write("MANUAL LORE PLEASE")
else:
f.write(str(rarity_sub[row['rarity']]) +
row['lore'].replace("'", "''"))
idx = pd.IndexSlice
enchants = row[['ARROW_DAMAGE', 'ARROW_FIRE', 'ARROW_INFINITE', 'ARROW_KNOCKBACK', 'BINDING_CURSE', 'CHANNELING', 'DAMAGE_ALL', 'DAMAGE_ARTHROPODS', 'DAMAGE_UNDEAD', 'DEPTH_STRIDER', 'DIG_SPEED', 'DURABILITY', 'FIRE_ASPECT', 'FROST_WALKER', 'IMPALING', 'KNOCKBACK', 'LOOT_BONUS_BLOCKS', 'LOOT_BONUS_MOBS',
'LOYALTY', 'LUCK', 'LURE', 'MENDING', 'MULTISHOT', 'OXYGEN', 'PIERCING', 'PROTECTION_ENVIRONMENTAL', 'PROTECTION_EXPLOSIONS', 'PROTECTION_FALL', 'PROTECTION_FIRE', 'PROTECTION_PROJECTILE', 'QUICK_CHARGE', 'RIPTIDE', 'SILK_TOUCH', 'SOUL_SPEED', 'SWEEPING_EDGE', 'SWIFT_SNEAK', 'THORNS', 'VANISHING_CURSE', 'WATER_WORKER']]
enchants.replace('', np.nan, inplace=True)
enchants.dropna(how='all', inplace=True)
for label, content in enchants.iteritems():
f.write(", " + label + ":" + str(int(content)))
f.write(
"'\n BlackListed-Permissions: {}\n Alternative-Prize:\n Toggle: false\n Messages: {}\n Commands: {}\n Items: {}\n")
# Write Header (Weekly Crate)
with open('twvc.yml', 'w') as f:
f.write("Crate:\n CrateType: CSGO\n CrateName: '&b&lWeekly Vote Crate'\n Preview-Name: '&b&lWeekly Vote Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 15\n OpeningBroadCast: False\n BroadCast: '&3* %Player% &3is opening a &bWeekly Vote Crate&3! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: '&bWeekly Vote Crate'\n Lore:\n - '&7Vote 36 times in a week gets a key.'\n - '&7You have &b%Keys% keys &7to open this crate with.'\n - '&7&l(&b&l!&7&l) Right click to view rewards.'\n")
f.write(" PhysicalKey:\n Name: '&cWeekly Vote Crate Key'\n Lore:\n - '&77Vote 36 times in a week gets a key.'\n - '&7Unlock this crate at spawn.'\n Item: 'TRIPWIRE_HOOK'\n Glowing: True\n Prizes:\n")
# Prizes
for index, row in weekly.iterrows():
f.write(" " + str(index + 1) + ":\n")
if row['name'] == '':
f.write(" DisplayName: ''\n")
else:
f.write(" DisplayName: '" +
str(rarity[row['rarity']]) + row['name'].replace("'", "''") + "'\n")
f.write(" DisplayItem: '" + row['itemtype'] + "'\n")
if row['trim'] == 'Yes':
f.write(" DisplayTrim:\n Material: '" + row['trimmat'] + "'\n Pattern: '" + row['trimtype'] + "'\n")
if row['name'] == '':
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win some " + row['itemtype'].lower().replace("_", " ").title() + "'\n")
else:
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win the " + row['name'].replace("'", "''") + "'\n")
f.write(" MaxRange: 75\n Chance: 1\n Firework: false\n Glowing: false\n Player: ''\n Unbreakable: false\n Items:\n - 'Item:" + row['itemtype'] + ", Amount:" +
str(int(row['amount'])))
if row['trim'] == 'Yes':
f.write(", Trim-Material:" + row['trimmat'] + ", Trim-Pattern:" + row['trimtype'])
if row['name'] == '':
f.write("")
else:
f.write(", Name:" + str(rarity[row['rarity']]) + row['name'].replace("'", "''") + ", Lore:")
if row['name'] == '':
f.write("")
else:
if "," in row['lore']:
f.write("MANUAL LORE PLEASE")
else:
f.write(str(rarity_sub[row['rarity']]) +
row['lore'].replace("'", "''"))
idx = pd.IndexSlice
enchants = row[['ARROW_DAMAGE', 'ARROW_FIRE', 'ARROW_INFINITE', 'ARROW_KNOCKBACK', 'BINDING_CURSE', 'CHANNELING', 'DAMAGE_ALL', 'DAMAGE_ARTHROPODS', 'DAMAGE_UNDEAD', 'DEPTH_STRIDER', 'DIG_SPEED', 'DURABILITY', 'FIRE_ASPECT', 'FROST_WALKER', 'IMPALING', 'KNOCKBACK', 'LOOT_BONUS_BLOCKS', 'LOOT_BONUS_MOBS',
'LOYALTY', 'LUCK', 'LURE', 'MENDING', 'MULTISHOT', 'OXYGEN', 'PIERCING', 'PROTECTION_ENVIRONMENTAL', 'PROTECTION_EXPLOSIONS', 'PROTECTION_FALL', 'PROTECTION_FIRE', 'PROTECTION_PROJECTILE', 'QUICK_CHARGE', 'RIPTIDE', 'SILK_TOUCH', 'SOUL_SPEED', 'SWEEPING_EDGE', 'SWIFT_SNEAK', 'THORNS', 'VANISHING_CURSE', 'WATER_WORKER']]
enchants.replace('', np.nan, inplace=True)
enchants.dropna(how='all', inplace=True)
for label, content in enchants.iteritems():
f.write(", " + label + ":" + str(int(content)))
f.write(
"'\n BlackListed-Permissions: {}\n Alternative-Prize:\n Toggle: false\n Messages: {}\n Commands: {}\n Items: {}\n")
# Write Header (Quest Crate)
with open('tqvc.yml', 'w') as f:
f.write("Crate:\n CrateType: CSGO\n CrateName: '&e&lQuest Crate'\n Preview-Name: '&e&lQuest Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 13\n OpeningBroadCast: False\n BroadCast: '&e* %Player% &eis opening a &6Quest Crate&e! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: '&eQuest Crate'\n Lore:\n - '&7This crate contains strange objects.'\n - '&7You have &6%Keys% keys &7to open this crate with.'\n - '&7&l(&e&l!&7&l) Right click to view rewards.'\n")
f.write(" PhysicalKey:\n Name: '&cQuest Crate Key'\n Lore:\n - '&7Complete a daily quest from Scruff!'\n - '&7Unlock this crate at spawn.'\n Item: 'TRIPWIRE_HOOK'\n Glowing: True\n Prizes:\n")
# Prizes
for index, row in quest.iterrows():
f.write(" " + str(index + 1) + ":\n")
if row['name'] == '':
f.write(" DisplayName: ''\n")
else:
f.write(" DisplayName: '" +
str(rarity[row['rarity']]) + row['name'].replace("'", "''") + "'\n")
f.write(" DisplayItem: '" + row['itemtype'] + "'\n")
if row['trim'] == 'Yes':
f.write(" DisplayTrim:\n Material: '" + row['trimmat'] + "'\n Pattern: '" + row['trimtype'] + "'\n")
if row['name'] == '':
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win some " + row['itemtype'].lower().replace("_", " ").title() + "'\n")
else:
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win the " + row['name'].replace("'", "''") + "'\n")
f.write(" MaxRange: 75\n Chance: 1\n Firework: false\n Glowing: false\n Player: ''\n Unbreakable: false\n Items:\n - 'Item:" + row['itemtype'] + ", Amount:" +
str(int(row['amount'])))
if row['trim'] == 'Yes':
f.write(", Trim-Material:" + row['trimmat'] + ", Trim-Pattern:" + row['trimtype'])
if row['name'] == '':
f.write("")
else:
f.write(", Name:" + str(rarity[row['rarity']]) + row['name'].replace("'", "''") + ", Lore:")
if row['name'] == '':
f.write("")
else:
if "," in row['lore']:
f.write("MANUAL LORE PLEASE")
else:
f.write(str(rarity_sub[row['rarity']]) +
row['lore'].replace("'", "''"))
idx = pd.IndexSlice
enchants = row[['ARROW_DAMAGE', 'ARROW_FIRE', 'ARROW_INFINITE', 'ARROW_KNOCKBACK', 'BINDING_CURSE', 'CHANNELING', 'DAMAGE_ALL', 'DAMAGE_ARTHROPODS', 'DAMAGE_UNDEAD', 'DEPTH_STRIDER', 'DIG_SPEED', 'DURABILITY', 'FIRE_ASPECT', 'FROST_WALKER', 'IMPALING', 'KNOCKBACK', 'LOOT_BONUS_BLOCKS', 'LOOT_BONUS_MOBS',
'LOYALTY', 'LUCK', 'LURE', 'MENDING', 'MULTISHOT', 'OXYGEN', 'PIERCING', 'PROTECTION_ENVIRONMENTAL', 'PROTECTION_EXPLOSIONS', 'PROTECTION_FALL', 'PROTECTION_FIRE', 'PROTECTION_PROJECTILE', 'QUICK_CHARGE', 'RIPTIDE', 'SILK_TOUCH', 'SOUL_SPEED', 'SWEEPING_EDGE', 'SWIFT_SNEAK', 'THORNS', 'VANISHING_CURSE', 'WATER_WORKER']]
enchants.replace('', np.nan, inplace=True)
enchants.dropna(how='all', inplace=True)
for label, content in enchants.iteritems():
f.write(", " + label + ":" + str(int(content)))
f.write(
"'\n BlackListed-Permissions: {}\n Alternative-Prize:\n Toggle: false\n Messages: {}\n Commands: {}\n Items: {}\n")