Skip to main content

Utilities and tools for things related to Dragon City

Project description

Soon to be documented, enjoy for now and install to discover the tools

Download static files

Sprites

Dragon sprite

from dcutils.static.sprites import DragonSprite

dragon_sprite = DragonSprite(
    image_name="1000_dragon_nature",
    phase=3,
    skin=1,
    image_quality=2
)

dragon_sprite.download(output="dragon_nature_sprite.png")

Dragon thumb

from dcutils.static.sprites import DragonThumb

dragon_thumb = DragonThumb(
    image_name="1000_dragon_nature",
    phase=3,
    skin=1
)

dragon_thumb.download(output="dragon_nature_thumb.png")

Animations

Dragon Animation (Flash Animation)

from dcutils.static.animations import DragonSpineAnimation

dragon_flash_animation = DragonFlashAnimation(
    image_name="1000_dragon_nature",
    phase=3,
    skin=1
)

dragon_flash_animation.download(output="dragon_nature_flash_animation.swf")

Dragon Animation (Spine Animation)

from dcutils.static.animations import DragonSpineAnimation

dragon_spine_animation = DragonSpineAnimation(
    image_name="1000_dragon_nature",
    phase=3,
    skin=1
)

dragon_spine_animation.download(output="dragon_spine_animation.zip")

Island packages

from dcutils.static.islands import IslandPackage

island_package = IslandPackage(uri="/mobile/ui/heroicraces_islands/hr_71_heroicorigins.zip")

island_package.download(output="island_package.zip")

Sounds

Musics

from dcutils.static.sounds import GeneralMusic

music = GeneralMusic(music_name="531_dc_party_planning_island")

music.download(output="531_dc_party_planning_island.mp3")

Tools

Calculators

Calculate elements strongs

from dcutils.tools.calculators import calculate_strongs

strongs = calculate_strongs(elements=["terra", "flame"])

Output:

['electric', 'flame', 'nature', 'ice']

Calculate elements weaknesses

from dcutils.tools.calculators import calculate_weaknesses

weaknesses = calculate_weaknesses(first_element="terra")

Output:

['metal', 'war']

Calculate orb recall gain

from dcutils.tools.calculators import calculate_orb_recall_gain

orb_recall_gain = calculate_orb_recall_gain(dragon_level=15, dragon_stars=2)

Output:

389

AI (Artificial Intelligence)

Elements detector

from dcutils.tools.ai.elements_detector import ElementsDetectorAI

elements_detector = ElementsDetectorAI()

elements_result = elements_detector.detect(image_path="ui_3110_dragon_hoardereternal_1@2x.png", limit=4)

Output:

[{'element': 'ice', 'confidence_score': 0.4871271550655365}, {'element': 'nature', 'confidence_score': 0.296091228723526}, {'element': 'flame', 'confidence_score': 0.16774502396583557}, {'element': 'sea', 'confidence_score': 0.03868602588772774}]

Phase detector

from dcutils.tools.ai.phase_detector import PhaseDetectorAI

phase_detector = PhaseDetectorAI()

phase_result = phase_detector.detect(image_path="ui_3110_dragon_hoardereternal_1@2x.png")

Output:

{'phase': 'baby', 'confidence_score': 0.9999938011169434}

Url parser

From flash animation

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.from_flash_animation("https://dci-static-s1.socialpointgames.com/static/dragoncity/assets/sprites/1000_dragon_nature_skin1_3.swf")

Output:

{'id': 1000, 'image_name': '1000_dragon_nature', 'phase': 3, 'skin': 'skin1'}

From spine atimation

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.fromspine_animation(url="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")

Output:

{'id': 1000, 'image_name': '1000_dragon_nature', 'phase': 3, 'skin': 'skin1'}

From sprite

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.from_sprite(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/ui_1000_dragon_nature_skin1_3@2x.png")

Output:

{'id': 1000, 'image_name': '1000_dragon_nature', 'phase': 3, 'skin': 'skin1', 'image_qualitity': '@2x'}

From thumb

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.from_thumb(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/HD/thumb_1000_dragon_nature_skin1_3.png")

Output:

{'id': 1000, 'image_name': '1000_dragon_nature', 'phase': 3, 'skin': 'skin1'}

Get id from anyone

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.get_id(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/HD/thumb_1000_dragon_nature_skin1_3.png")

Output:

1000

Get image name from anyone

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.get_image_name(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/HD/thumb_1000_dragon_nature_skin1_3.png")

Output:

1000_dragon_nature

Get image qualitity from anyone

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.get_image_qualitity(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/ui_1000_dragon_nature_skin1_3@2x.png")

Output:

@2x

Get phase from anyone

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.get_phase(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/ui_1000_dragon_nature_skin1_3@2x.png")

Output:

3

Get skin from anyone

from dcutils.tools.url_parser.dragon import DragonUrlParser

result = DragonUrlParser.get_skin(url="https://dci-static-s1.socialpointgames.com/static/dragoncity/mobile/ui/dragons/ui_1000_dragon_nature_skin1_3@2x.png")

Output:

skin1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dragon-city-utils-1.24.2.tar.gz (24.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page