Update rarity names, item names, and enchantments mapping

Rarity and item names in the code have been updated to the new names crazy crates needs. Enchantments are now mapped from the old names to the new ones. Additionally we switched from & color codes to minimessage colors.
This commit is contained in:
Teriuihi 2024-07-05 18:14:27 +02:00
parent 277929ac4e
commit 208f039554

View File

@ -8,11 +8,11 @@ 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 = {'Legendary': '<gold>', 'Epic': '<light_purple>',
'Rare': '<dark_aqua>', 'Uncommon': '<green>', 'Common': '<white>', 'Quest': '<red>', 'Grove Staff': '<#f558b4>', 'Admin Staff': '<dark_red>'}
rarity_sub = {'Legendary': '&c', 'Epic': '&5',
'Rare': '&9', 'Uncommon': '&2', 'Common': '&7', 'Quest': '&7', 'Grove Staff': '#f50a93', 'Admin Staff': '&c'}
rarity_sub = {'Legendary': '<red>', 'Epic': '<dark_purple>',
'Rare': '<blue>', 'Uncommon': '<dark_green>', 'Common': '<gray>', 'Quest': '<gray>', 'Grove Staff': '<#f50a93>', 'Admin Staff': '<red>'}
# Replace filename with whatever the downloaded entry form sheet is called
filename = 'ItemEntry.csv'
@ -32,10 +32,13 @@ daily = df[df["crate"] == "Daily Crate"]
weekly = df[df["crate"] == "Weekly Crate"]
quest = df[df["crate"] == "Quest Crate"]
enchant_map = {'ARROW_DAMAGE': 'power', 'ARROW_FIRE': 'flame', 'ARROW_INFINITE': 'infinity', 'ARROW_KNOCKBACK': 'punch', 'BINDING_CURSE': 'binding_curse', 'CHANNELING': 'channeling', 'DAMAGE_ALL': 'sharpness', 'DAMAGE_ARTHROPODS': 'bane_of_arthropods', 'DAMAGE_UNDEAD': 'smite', 'DEPTH_STRIDER': 'depth_strider', 'DIG_SPEED': 'efficiency', 'DURABILITY': 'unbreaking', 'FIRE_ASPECT': 'fire_aspect', 'FROST_WALKER': 'frost_walker', 'IMPALING': 'impaling', 'KNOCKBACK': 'knockback', 'LOOT_BONUS_BLOCKS': 'fortune', 'LOOT_BONUS_MOBS': 'looting', 'LOYALTY': 'loyalty', 'LUCK': 'luck_of_the_sea', 'LURE': 'lure', 'MENDING': 'mending', 'MULTISHOT': 'multishot', 'OXYGEN': 'respiration', 'PIERCING': 'piercing', 'PROTECTION_ENVIRONMENTAL': 'protection', 'PROTECTION_EXPLOSIONS': 'blast_protection', 'PROTECTION_FALL': 'feather_falling', 'PROTECTION_FIRE': 'fire_protection', 'PROTECTION_PROJECTILE': 'projectile_protection', 'QUICK_CHARGE': 'quick_charge', 'RIPTIDE': 'riptide', 'SILK_TOUCH': 'silk_touch', 'SOUL_SPEED': 'soul_speed', 'SWEEPING_EDGE': 'sweeping_edge', 'SWIFT_SNEAK': 'swift_sneak', 'THORNS': 'thorns', 'VANISHING_CURSE': 'vanishing_curse', 'WATER_WORKER': 'aqua_affinity' }
old_names = ['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']
# 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")
f.write("Crate:\n CrateType: CSGO\n CrateName: '<yellow><b>Daily Vote Crate'\n Preview-Name: '<yellow><b>Daily Vote Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 13\n OpeningBroadCast: False\n BroadCast: '<yellow>* %Player% <yellow>is opening a <gold>Daily Vote Crate<yellow>! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: '<yellow>Daily Vote Crate'\n Lore:\n - '<gray>This crate contains strange objects.'\n - '<gray>You have <gold>%Keys% keys <gray>to open this crate with.'\n - '<gray><b>(<yellow><b>!<gray><b>) Right click to view rewards.'\n")
f.write(" PhysicalKey:\n Name: '<red>Daily Vote Crate Key'\n DisplayLore:\n - '<gray>Vote on 5 sites every day!'\n - '<gray>Unlock this crate at spawn.'\n Item: 'tripwire_hook'\n Glowing: True\n Prizes:\n")
# Prizes
for index, row in daily.iterrows():
@ -46,19 +49,19 @@ with open('tdvc.yml', 'w') as f:
f.write(" DisplayName: '" +
str(rarity[row['rarity']]) + row['name'].replace("'", "''") + "'\n")
f.write(" DisplayItem: '" + row['itemtype'] + "'\n")
f.write(" DisplayItem: '" + row['itemtype'].lower() + "'\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")
str(int(row['amount'])) + "\n DisplayLore:\n - '" + str(rarity_sub[row['rarity']]) + "Win some " + row['itemtype'].replace("_", " ").title().lower() + "'\n")
else:
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win the " + row['name'].replace("'", "''") + "'\n")
str(int(row['amount'])) + "\n DisplayLore:\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:" +
f.write(" MaxRange: 75\n Chance: 1\n Firework: false\n Glowing: false\n Player: ''\n Unbreakable: false\n Items:\n - 'Item:" + row['itemtype'].lower() + ", Amount:" +
str(int(row['amount'])))
if row['trim'] == 'Yes':
@ -79,12 +82,14 @@ with open('tdvc.yml', 'w') as f:
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 = row[old_names]
enchants.replace('', np.nan, inplace=True)
enchants = enchants.apply(pd.to_numeric, errors='ignore', downcast='integer')
enchants.dropna(how='all', inplace=True)
for label, content in enchants.iteritems():
enchants = enchants.rename(index=enchant_map)
for label, content in enchants.items():
f.write(", " + label + ":" + str(int(content)))
f.write(
@ -93,8 +98,8 @@ with open('tdvc.yml', 'w') as f:
# 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")
f.write("Crate:\n CrateType: CSGO\n CrateName: '<aqua><b>Weekly Vote Crate'\n Preview-Name: '<aqua><b>Weekly Vote Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 15\n OpeningBroadCast: False\n BroadCast: '<dark_aqua>* %Player% <dark_aqua>is opening a <aqua>Weekly Vote Crate<dark_aqua>! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: '<aqua>Weekly Vote Crate'\n DisplayLore:\n - '<gray>Vote 36 times in a week gets a key.'\n - '<gray>You have <aqua>%Keys% keys <gray>to open this crate with.'\n - '<gray><b>(<aqua><b>!<gray><b>) Right click to view rewards.'\n")
f.write(" PhysicalKey:\n Name: '<red>Weekly Vote Crate Key'\n DisplayLore:\n - '<gray>Vote 36 times in a week gets a key.'\n - '<gray>Unlock this crate at spawn.'\n Item: 'tripwire_hook'\n Glowing: True\n Prizes:\n")
# Prizes
for index, row in weekly.iterrows():
@ -105,19 +110,19 @@ with open('twvc.yml', 'w') as f:
f.write(" DisplayName: '" +
str(rarity[row['rarity']]) + row['name'].replace("'", "''") + "'\n")
f.write(" DisplayItem: '" + row['itemtype'] + "'\n")
f.write(" DisplayItem: '" + row['itemtype'].lower() + "'\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")
str(int(row['amount'])) + "\n DisplayLore:\n - '" + str(rarity_sub[row['rarity']]) + "Win some " + row['itemtype'].replace("_", " ").title().lower() + "'\n")
else:
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win the " + row['name'].replace("'", "''") + "'\n")
str(int(row['amount'])) + "\n DisplayLore:\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:" +
f.write(" MaxRange: 75\n Chance: 1\n Firework: false\n Glowing: false\n Player: ''\n Unbreakable: false\n Items:\n - 'Item:" + row['itemtype'].lower() + ", Amount:" +
str(int(row['amount'])))
if row['trim'] == 'Yes':
@ -138,11 +143,13 @@ with open('twvc.yml', 'w') as f:
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 = row[old_names]
enchants.replace('', np.nan, inplace=True)
enchants = enchants.apply(pd.to_numeric, errors='ignore', downcast='integer')
enchants.dropna(how='all', inplace=True)
enchants = enchants.rename(index=enchant_map)
for label, content in enchants.iteritems():
f.write(", " + label + ":" + str(int(content)))
@ -152,8 +159,10 @@ with open('twvc.yml', 'w') as f:
# 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")
f.write(
"Crate:\n CrateType: CSGO\n CrateName: '<yellow><b>Quest Crate'\n Preview-Name: '<yellow><b>Quest Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 13\n OpeningBroadCast: False\n BroadCast: '<yellow>* %Player% <yellow>is opening a <gold>Quest Crate<yellow>! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: '<yellow>Quest Crate'\n DisplayLore:\n - '<gray>This crate contains strange objects.'\n - '<gray>You have <gold>%Keys% keys <gray>to open this crate with.'\n - '<gray><b>(<yellow><b>!<gray><b>) Right click to view rewards.'\n")
f.write(
" PhysicalKey:\n Name: '<red>Quest Crate Key'\n Lore:\n - '<gray>Complete a daily quest from Scruff!'\n - '<gray>Unlock this crate at spawn.'\n Item: 'tripwire_hook'\n Glowing: True\n Prizes:\n")
# Prizes
for index, row in quest.iterrows():
@ -164,19 +173,19 @@ with open('tqvc.yml', 'w') as f:
f.write(" DisplayName: '" +
str(rarity[row['rarity']]) + row['name'].replace("'", "''") + "'\n")
f.write(" DisplayItem: '" + row['itemtype'] + "'\n")
f.write(" DisplayItem: '" + row['itemtype'].lower() + "'\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")
str(int(row['amount'])) + "\n DisplayLore:\n - '" + str(rarity_sub[row['rarity']]) + "Win some " + row['itemtype'].replace("_", " ").title().lower() + "'\n")
else:
f.write(" DisplayAmount: " +
str(int(row['amount'])) + "\n Lore:\n - '" + str(rarity_sub[row['rarity']]) + "Win the " + row['name'].replace("'", "''") + "'\n")
str(int(row['amount'])) + "\n DisplayLore:\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:" +
f.write(" MaxRange: 75\n Chance: 1\n Firework: false\n Glowing: false\n Player: ''\n Unbreakable: false\n Items:\n - 'Item:" + row['itemtype'].lower() + ", Amount:" +
str(int(row['amount'])))
if row['trim'] == 'Yes':
@ -197,12 +206,14 @@ with open('tqvc.yml', 'w') as f:
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 = row[old_names]
enchants.replace('', np.nan, inplace=True)
enchants = enchants.apply(pd.to_numeric, errors='ignore', downcast='integer')
enchants.dropna(how='all', inplace=True)
for label, content in enchants.iteritems():
enchants = enchants.rename(index=enchant_map)
for label, content in enchants.items():
f.write(", " + label + ":" + str(int(content)))
f.write(