From 208f0395549a3b5a70828ddd7c28407fe35e98a9 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Fri, 5 Jul 2024 18:14:27 +0200 Subject: [PATCH] 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. --- config_creator_v2.py | 71 +++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/config_creator_v2.py b/config_creator_v2.py index cbddd5e..295badf 100644 --- a/config_creator_v2.py +++ b/config_creator_v2.py @@ -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': '', 'Epic': '', + 'Rare': '', 'Uncommon': '', 'Common': '', 'Quest': '', 'Grove Staff': '<#f558b4>', 'Admin Staff': ''} -rarity_sub = {'Legendary': '&c', 'Epic': '&5', - 'Rare': '&9', 'Uncommon': '&2', 'Common': '&7', 'Quest': '&7', 'Grove Staff': '#f50a93', 'Admin Staff': '&c'} +rarity_sub = {'Legendary': '', 'Epic': '', + 'Rare': '', 'Uncommon': '', 'Common': '', 'Quest': '', 'Grove Staff': '<#f50a93>', 'Admin Staff': ''} # 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: 'Daily Vote Crate'\n Preview-Name: 'Daily Vote Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 13\n OpeningBroadCast: False\n BroadCast: '* %Player% is opening a Daily Vote Crate! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: 'Daily Vote Crate'\n Lore:\n - 'This crate contains strange objects.'\n - 'You have %Keys% keys to open this crate with.'\n - '(!) Right click to view rewards.'\n") + f.write(" PhysicalKey:\n Name: 'Daily Vote Crate Key'\n DisplayLore:\n - 'Vote on 5 sites every day!'\n - '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: 'Weekly Vote Crate'\n Preview-Name: 'Weekly Vote Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 15\n OpeningBroadCast: False\n BroadCast: '* %Player% is opening a Weekly Vote Crate! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: 'Weekly Vote Crate'\n DisplayLore:\n - 'Vote 36 times in a week gets a key.'\n - 'You have %Keys% keys to open this crate with.'\n - '(!) Right click to view rewards.'\n") + f.write(" PhysicalKey:\n Name: 'Weekly Vote Crate Key'\n DisplayLore:\n - 'Vote 36 times in a week gets a key.'\n - '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: 'Quest Crate'\n Preview-Name: 'Quest Crate Preview'\n StartingKeys: 0\n InGUI: false\n Slot: 13\n OpeningBroadCast: False\n BroadCast: '* %Player% is opening a Quest Crate! (/vote)'\n Item: 'CHEST'\n Glowing: false\n Name: 'Quest Crate'\n DisplayLore:\n - 'This crate contains strange objects.'\n - 'You have %Keys% keys to open this crate with.'\n - '(!) Right click to view rewards.'\n") + f.write( + " PhysicalKey:\n Name: 'Quest Crate Key'\n Lore:\n - 'Complete a daily quest from Scruff!'\n - '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(