diff --git a/ObjectStatistics/full_tech_tree_processing.py b/ObjectStatistics/full_tech_tree_processing.py index 0001565..8d94615 100644 --- a/ObjectStatistics/full_tech_tree_processing.py +++ b/ObjectStatistics/full_tech_tree_processing.py @@ -21,6 +21,8 @@ def create_localised_name_lookup(category_key: str) -> dict[EntityId, str]: localised_unit_building_name_lookup = create_localised_name_lookup("units_buildings") +print(localised_unit_building_name_lookup) + # Hardcode a fix for Huskarl because it appears again at "759", # but "759" does not exist in the other json localised_unit_building_name_lookup["Huskarl"] = "41" diff --git a/TechTreeProcessing/techtree.py b/TechTreeProcessing/techtree.py index 69483d5..fef9970 100644 --- a/TechTreeProcessing/techtree.py +++ b/TechTreeProcessing/techtree.py @@ -49,6 +49,9 @@ name = directory["techs"][str(x)]["localised_name"] tech_dict[name] = x +castle_age_unique_techs = [] +imperial_age_unique_techs = [] + for c in civs: x = techtree["techtrees"][c]["unique"]["castleAgeUniqueUnit"] name = directory["units_buildings"][str(x)]["localised_name"] @@ -59,9 +62,11 @@ x = techtree["techtrees"][c]["unique"]["castleAgeUniqueTech"] name = directory["techs"][str(x)]["localised_name"] master_dict[name] = [c] + castle_age_unique_techs.append(name) x = techtree["techtrees"][c]["unique"]["imperialAgeUniqueTech"] name = directory["techs"][str(x)]["localised_name"] master_dict[name] = [c] + imperial_age_unique_techs.append(name) for item in unit_dict.keys(): master_dict[item] = [] @@ -88,5 +93,18 @@ if pay in techtree["techtrees"][c]["techs"]: master_dict[key].append(c) +# Make a json for Castle and Imperial Age unique techs +castle_age_unique_techs.sort() +imperial_age_unique_techs.sort() +<<<<<<< Updated upstream print(master_dict) +======= +unique_techs = {} +unique_techs["castle_age_unique_techs"] = castle_age_unique_techs +unique_techs["imperial_age_unique_techs"] = imperial_age_unique_techs + +with open('unique_techs.json', 'w') as json_file: + json.dump(unique_techs, json_file) +# print(master_dict) +>>>>>>> Stashed changes diff --git a/cog_modules/random/cog.py b/cog_modules/random/cog.py index f1916b9..8d25bcc 100644 --- a/cog_modules/random/cog.py +++ b/cog_modules/random/cog.py @@ -14,8 +14,8 @@ load_dotenv() CATS = os.getenv("x-api-key") -botDMs = int(os.getenv("DMChannel")) -botID = int(os.getenv("BOTID")) +# botDMs = int(os.getenv("DMChannel")) +# botID = int(os.getenv("BOTID")) class Random(commands.Cog): @@ -105,16 +105,16 @@ async def gizmo_or_tao(self, ctx: commands.Context): # Checks to see if someone DMs the bot # If so, it forwards the message to a specific channel and replies to the # person who sent the message - @commands.Cog.listener() - async def on_message(self, message): - if isinstance(message.channel, discord.DMChannel): # if the message is a DM - channel = self.bot.get_channel(botDMs) # get channel to forward message to - if message.author.id != botID: # make sure we're not forwarding/sending messages when the bot messages - newMessage = discord.Embed( - title=f"New bot DM from `{message.author}`", description=f"{message.content}", timestamp=message.created_at - ) - await channel.send(embed=newMessage) # forwards message to channel - await self.bot.process_commands(message) + # @commands.Cog.listener() + # async def on_message(self, message): + # if isinstance(message.channel, discord.DMChannel): # if the message is a DM + # channel = self.bot.get_channel(botDMs) # get channel to forward message to + # if message.author.id != botID: # make sure we're not forwarding/sending messages when the bot messages + # newMessage = discord.Embed( + # title=f"New bot DM from `{message.author}`", description=f"{message.content}", timestamp=message.created_at + # ) + # await channel.send(embed=newMessage) # forwards message to channel + # await self.bot.process_commands(message) async def setup(bot: commands.Bot): diff --git a/cog_modules/stats/cog.py b/cog_modules/stats/cog.py index 5dcbe8d..d1f7e07 100644 --- a/cog_modules/stats/cog.py +++ b/cog_modules/stats/cog.py @@ -18,6 +18,12 @@ with open("descriptions_cleaned.json") as fp: descriptions = json.load(fp) +<<<<<<< Updated upstream +======= +# Load the unique_techs.json file as unique_techs +with open("unique_techs.json") as fp: + unique_techs = json.load(fp) +>>>>>>> Stashed changes class StatCommands(commands.Cog): """Commands for stat commands.""" @@ -83,9 +89,21 @@ async def statInfo(self, ctx: commands.Context, arg1, arg2=None, arg3=None, arg4 embed = discord.Embed(title=f"{input} Stats", description=f"Information about {input}s.", color=0xD5D341) else: embed = discord.Embed(title=f"{input} Stats", description=f"Information about {input}.", color=0xD5D341) - embed.set_thumbnail( - url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/{unitBuildNum}.png" - ) + + # Check to see if entity is a Castle Age Unique Tech + if input in unique_techs["castle_age_unique_techs"]: + embed.set_thumbnail( + url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/unique_tech_1.png" + ) + # Check to see if entity is a Castle Age Unique Tech + elif input in unique_techs["imperial_age_unique_techs"]: + embed.set_thumbnail( + url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/unique_tech_2.png" + ) + else: + embed.set_thumbnail( + url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/{unitBuildNum}.png" + ) embed.add_field(name="Cost", value=costString2, inline=True) if entity == "techs": @@ -171,9 +189,20 @@ async def advstatInfo(self, ctx: commands.Context, arg1, arg2=None, arg3=None, a else: embed = discord.Embed(title=f"{input} Stats", description=f"Information about {input}.", color=0xD5D341) - embed.set_thumbnail( - url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/{unitBuildNum}.png" - ) + # Check to see if entity is a Castle Age Unique Tech + if input in unique_techs["castle_age_unique_techs"]: + embed.set_thumbnail( + url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/unique_tech_1.png" + ) + # Check to see if entity is a Castle Age Unique Tech + elif input in unique_techs["imperial_age_unique_techs"]: + embed.set_thumbnail( + url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/unique_tech_2.png" + ) + else: + embed.set_thumbnail( + url=f"https://raw.githubusercontent.com/SiegeEngineers/aoe2techtree/master/img/{entityDirectory}/{unitBuildNum}.png" + ) embed.add_field(name="Cost", value=costString2, inline=True) if entity == "techs": diff --git a/full_tech_tree_processing.py b/full_tech_tree_processing.py index 5342b93..75c6894 100644 --- a/full_tech_tree_processing.py +++ b/full_tech_tree_processing.py @@ -20,6 +20,7 @@ def create_localised_name_lookup(category_key): localised_name_lookup = {} for key, value in directory[category_key].items(): + # print(key, value["localised_name"]) if value["localised_name"] in localised_name_lookup: localised_name_lookup[value["localised_name"]] = str( min(int(key), int(localised_name_lookup[value["localised_name"]])) @@ -49,6 +50,8 @@ def create_localised_name_lookup(category_key): localised_unit_building_name_lookup["Monastery"] = "104" localised_unit_building_name_lookup["Condottiero"] = "882" localised_unit_building_name_lookup["Villager"] = "83" +localised_unit_building_name_lookup["Gate"] = "487" +localised_unit_building_name_lookup["Palisade Gate"] = "792" # This list comes from this java script file. diff --git a/unique_techs.json b/unique_techs.json new file mode 100644 index 0000000..7c48e5d --- /dev/null +++ b/unique_techs.json @@ -0,0 +1 @@ +{"castle_age_unique_techs": ["Anarchy", "Andean Sling", "Atlatl", "Ballistas", "Bearded Axe", "Bimaristan", "Burgundian Vineyards", "Carrack", "Chatras", "Chieftains", "Cilician Fleet", "Corvinian Army", "Detinets", "Eupseong", "First Crusade", "Grand Trunk Road", "Great Wall", "Greek Fire", "Hill Forts", "Hul'che Javelineers", "Inquisition", "Ironclad", "Kamandaran", "Kasbah", "Kshatriyas", "Manipur Cavalry", "Marauders", "Medical Corps", "Nomads", "Paiks", "Pavise", "Royal Heirs", "Silk Armor", "Sipahi", "Steppe Husbandry", "Stirrups", "Stronghold", "Svan Towers", "Szlachta Privileges", "Thalassocracy", "Tigui", "Tusk Swords", "Wagenburg Tactics", "Yasama", "Yeomen"], "imperial_age_unique_techs": ["Arquebus", "Artillery", "Atheism", "Aznauri Cavalry", "Bagains", "Bogsveigar", "Chivalry", "Citadels", "Comitatenses", "Counterweights", "Crenellations", "Cuman Mercenaries", "Double Crossbow", "Drill", "Druzhina", "El Dorado", "Fabric Shields", "Farimba", "Fereters", "Flemish Revolution", "Forced Levy", "Frontier Guards", "Furor Celtica", "Garland Wars", "Hauberk", "Howdah", "Hussite Reforms", "Kataparuto", "Lechitic Legacy", "Logistica", "Maghrebi Camels", "Mahayana", "Paper Money", "Perfusion", "Recurve Bow", "Rocketry", "Shatagni", "Shinkichon", "Silk Road", "Supremacy", "Timurid Siegecraft", "Torsion Engines", "Tower Shields", "Warwolf", "Wootz Steel"]} \ No newline at end of file