{"id":25735514,"url":"https://github.com/marcuth/py.dragon-city-utils","last_synced_at":"2026-06-09T22:31:31.888Z","repository":{"id":142225743,"uuid":"609270395","full_name":"marcuth/py.dragon-city-utils","owner":"marcuth","description":"Dragon City Utils is a library that helps you handle static file downloading, localization, calculations and extracting data from urls related to Dragon City. Additionally, we are experimenting with using AI to do some estimations too!","archived":false,"fork":false,"pushed_at":"2024-05-20T12:27:24.000Z","size":272,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T19:41:23.621Z","etag":null,"topics":["city","dragon","legends","monster","python","tools","utilities"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dragon-city-utils/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcuth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-03T18:30:52.000Z","updated_at":"2024-06-21T00:50:04.000Z","dependencies_parsed_at":"2025-01-24T12:36:18.257Z","dependency_job_id":null,"html_url":"https://github.com/marcuth/py.dragon-city-utils","commit_stats":null,"previous_names":["marcuth/py.dragon-city-utils","1marcuth/py.dragon-city-utils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcuth/py.dragon-city-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuth%2Fpy.dragon-city-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuth%2Fpy.dragon-city-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuth%2Fpy.dragon-city-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuth%2Fpy.dragon-city-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcuth","download_url":"https://codeload.github.com/marcuth/py.dragon-city-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuth%2Fpy.dragon-city-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34129072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["city","dragon","legends","monster","python","tools","utilities"],"created_at":"2025-02-26T05:30:58.287Z","updated_at":"2026-06-09T22:31:31.869Z","avatar_url":"https://github.com/marcuth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dragon-city-utils\n\nWelcome to the documentation of Dragon City Utils, a collection of tools and utilities for managing static assets and performing calculations related to the game Dragon City. Below, you'll find detailed explanations and code snippets for various functionalities.\n\n## Static Files\n\n### Sprites\n\n#### Dragon Sprite\n\nYou can download a dragon sprite using the following code:\n\n```python\nfrom dcutils.static.sprites import DragonSprite\n\ndragon_sprite = DragonSprite(\n    image_name = \"1000_dragon_nature\",\n    phase = 3,\n    skin = \"skin1\",\n    image_quality = 2\n)\n\ndragon_sprite.download(output=\"dragon_nature_sprite.png\")\n```\n#### Dragon Thumb\n\nTo download a dragon thumb:\n\n```python\nfrom dcutils.static.sprites import DragonThumb\n\ndragon_thumb = DragonThumb(\n    image_name = \"1000_dragon_nature\",\n    phase = 3,\n    skin = \"skin1\"\n)\n\ndragon_thumb.download(output=\"dragon_nature_thumb.png\")\n```\n\n### Animations\n\n#### Dragon Animation (Flash Animation)\n\nTo download a dragon flash animation:\n\n```python\nfrom dcutils.static.animations import DragonFlashAnimation\n\ndragon_flash_animation = DragonFlashAnimation(\n    image_name = \"1000_dragon_nature\",\n    phase = 3,\n    skin = \"skin1\"\n)\n\ndragon_flash_animation.download(output=\"dragon_nature_flash_animation.swf\")\n```\n\n#### Dragon Animation (Spine Animation)\n\nTo download a dragon spine animation:\n\n```python\nfrom dcutils.static.animations import DragonSpineAnimation\n\ndragon_spine_animation = DragonSpineAnimation(\n    image_name = \"1000_dragon_nature\",\n    phase = 3,\n    skin = 1\n)\n\ndragon_spine_animation.download(output=\"dragon_spine_animation.zip\")\n```\n\n### Island Packages\n\nTo download an island package:\n\n```python\nfrom dcutils.static.islands import IslandPackage\n\nisland_package = IslandPackage(uri = \"/mobile/ui/heroicraces_islands/hr_71_heroicorigins.zip\")\n\nisland_package.download(output = \"island_package.zip\")\n```\n\n### Sounds\n\n#### Music\n\nTo download music:\n\n```python\nfrom dcutils.static.sounds import GeneralMusic\n\nmusic = GeneralMusic(music_name = \"531_dc_party_planning_island\")\n\nmusic.download(output = \"531_dc_party_planning_island.mp3\")\n```\n\n## Tools\n\n### Calculators\n\n#### Calculate Element Strengths\n\n```python\nfrom dcutils.tools.calculators import calculate_strongs\n\nstrongs = calculate_strongs(elements = [\"terra\", \"flame\"])\n```\n**Output:**\n```\n['electric', 'flame', 'nature', 'ice']\n```\n\n#### Calculate Element Weaknesses\n\n```python\nfrom dcutils.tools.calculators import calculate_weaknesses\n\nweaknesses = calculate_weaknesses(first_element=\"terra\")\n```\n**Output:**\n```\n['metal', 'war']\n```\n\n#### Calculate Orb Recall Gain\n\n```python\nfrom dcutils.tools.calculators import calculate_orb_recall_gain\n\norb_recall_gain = calculate_orb_recall_gain(dragon_level = 15, dragon_stars = 2)\n```\n**Output:**\n```\n389\n```\n\n### Calculate Attack Damage\n\nYou can calculate attack damage using the `calculate_attack_damage` function.\n\n```python\nfrom dcutils.tools.calculators.dragon import calculate_attack_damage\n\ndamage_info = calculate_attack_damage(\n    category = 1,\n    level = 50,\n    attack_power=  1000,\n    rank_class = 3,\n    stars = 2\n)\n```\n\n### Calculate\n\nYou can calculate dragon status using the `calculate_status` function.\n\n```python\nfrom dcutils.tools.calculators.dragon import calculate_status\n\nstatus_info = calculate_status(\n    category = 1,\n    rarity = \"R\",\n    level = 50,\n    rank_class = 3,\n    stars = 2,\n    hp_runes = 5,\n    damage_runes = 3,\n    with_tower_bonus = True,\n    extra_hp_multiplier=  0.1,\n    extra_damage_multiplier = 0.05\n)\n```\n\n### AI (Artificial Intelligence)\n\n#### Elements Detector\n\n```python\nfrom dcutils.tools.ai.elements_detector import ElementsDetectorAI\n\nelements_detector = ElementsDetectorAI()\n\nelements_result = elements_detector.detect(image_path = \"ui_3110_dragon_hoardereternal_1@2x.png\", limit = 4)\n```\n**Output:**\n```\n[{'element': 'ice', 'confidence_score': 0.4871271550655365}, {'element': 'nature', 'confidence_score': 0.296091228723526}, {'element': 'flame', 'confidence_score': 0.16774502396583557}, {'element': 'sea', 'confidence_score': 0.03868602588772774}]\n```\n\n#### Phase Detector\n\n```python \nfrom dcutils.tools.ai.phase_detector import PhaseDetectorAI\n\nphase_detector = PhaseDetectorAI()\n\nphase_result = phase_detector.detect(image_path=\"ui_3110_dragon_hoardereternal_1@2x.png\")\n```\n**Output:**\n```\n{'phase': 'baby', 'confidence_score': 0.9999938011169434}\n```\n\n### URL Parser\n\n#### Dragon URL Parser\n\nYou can parse various information from Dragon URLs:\n\n```python\nfrom dcutils.tools.url_parser.dragon import DragonUrlParser\n\n# Example URLs\nurl_flash_animation = \"https://dci-static-s1.socialpointgames.com/static/dragoncity/assets/sprites/1000_dragon_nature_skin1_3.swf\"\nurl_spine_animation = \"https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/engine/version_1_1/dragons/1000_dragon_nature_3/1000_dragon_nature_skin1_3_HD_tweened_dxt5.zip\"\nurl_sprite = \"https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/ui_1000_dragon_nature_skin1_3@2x.png\"\nurl_thumb = \"https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/HD/thumb_1000_dragon_nature_skin1_3.png\"\n\n# Parse from URLs\nresult_flash_animation = DragonUrlParser.from_flash_animation(url_flash_animation)\nresult_spine_animation = DragonUrlParser.from_spine_animation(url_spine_animation)\nresult_sprite = DragonUrlParser.from_sprite(url_sprite)\nresult_thumb = DragonUrlParser.from_thumb(url_thumb)\n\n# Get specific information\ndragon_id = DragonUrlParser.get_id(url_thumb)\nimage_name = DragonUrlParser.get_image_name(url_thumb)\nimage_quality = DragonUrlParser.get_image_quality(url_sprite)\nphase = DragonUrlParser.get_phase(url_sprite)\nskin = DragonUrlParser.get_skin(url_sprite)\n```\n\nEach function returns relevant information parsed from the given Dragon URL.\n\nFeel free to explore these functionalities and integrate them into your projects!\n\n## Localization\n\nThe `Localization` class allows you to handle localization data efficiently. You can load localization from files, fetch it from an endpoint, and perform various operations on the data.\n\n```python\nfrom dcutils.static.localization import Localization\n\n# Example usage\nloc = Localization(language = \"en\")\nprint(loc)\n```\n\n### Methods\n\n#### load_file\n\nLoad localization data from a file.\n\n```python\nloc = Localization.load_file(file_path = \"localization.json\")\n```\n\n#### load_compressed_file\n\nLoad compressed localization data from a file.\n\n```python\nloc = Localization.load_compressed_file(file_path = \"localization.gz\")\n```\n\n#### fetch\n\nFetch localization data from an endpoint.\n\n```python\nloc_data = Localization.fetch(language = \"en\")\n```\n\n#### get_value_from_key\n\nGet the value from a key in the localization data.\n\n```python\nvalue = loc.get_value_from_key(\"key_name\")\n```\n\n#### get_key_from_value\n\nGet the key from a value in the localization data.\n\n```python\nkey = loc.get_key_from_value(\"value_name\")\n```\n\n#### get_dragon_name\n\nGet the name of a dragon based on its ID.\n\n```python\nname = loc.get_dragon_name(id = 1000)\n```\n\n#### get_dragon_description\n\nGet the description of a dragon based on its ID.\n\n```python\ndescription = loc.get_dragon_description(id = 1000)\n```\n\n#### get_attack_name\n\nGet the name of an attack based on its ID.\n\n```python\nname = loc.get_attack_name(id = 1)\n```\n\n#### get_skill_name\n\nGet the name of a skill based on its ID.\n\n```python\nname = loc.get_skill_name(id = 1)\n```\n\n#### get_skill_description\n\nGet the description of a skill based on its ID.\n\n```python\ndescription = loc.get_skill_description(id = 1)\n```\n\n#### search_keys\n\nSearch for keys containing a specific query.\n\n```python\nkeys = loc.search_keys(query = \"search_query\")\n```\n\n#### search_values\n\nSearch for values containing a specific query.\n\n```python\nvalues = loc.search_values(query = \"search_query\")\n```\n\n#### compare\n\nCompare the current localization data with old localization data.\n\n```python\ncomparison = loc.compare(old_localization = old_loc)\n```\n\n### Properties\n\n#### list\n\nGet the localization data as a list.\n\n```python\nloc_list = loc.list\n```\n\n#### dict\n\nGet the localization data as a dictionary.\n\n```python\nloc_dict = loc.dict\n```\n\nFeel free to explore these functionalities and integrate them into your projects!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuth%2Fpy.dragon-city-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcuth%2Fpy.dragon-city-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuth%2Fpy.dragon-city-utils/lists"}