예제 #1
0
async def get_spec_ranking(spec_slug,
                           boss_slug,
                           difficulty: str = "mythic",
                           metric: str = "",
                           limit: int = 0):
    if not metric:
        spec = WowSpec.get(full_name_slug=spec_slug)
        metric = spec.role.metric

    spec_ranking = warcraftlogs_ranking.SpecRanking.get_or_create(
        boss_slug=boss_slug,
        spec_slug=spec_slug,
        difficulty=difficulty,
        metric=metric,
    )
    fights = spec_ranking.fights or []
    if limit:
        fights = fights[:limit]

    # remove bosses
    for fight in fights[1:]:
        fight.boss = None

    return {
        "fights": [fight.as_dict() for fight in fights],
        "updated": int(spec_ranking.updated.timestamp()),
        "difficulty": difficulty,
        "metric": metric,
    }
예제 #2
0
async def get_spec_spells(spec_slug: str):
    """Get all spells for a given spec.

    Args:
        spec_slug (str): name of the spec

    """
    spec: WowSpec = WowSpec.get(full_name_slug=spec_slug)
    if not spec:
        return "Invalid Spec.", 404

    abilities = spec.all_spells + spec.all_buffs + spec.all_debuffs + spec.all_events
    return {spell.spell_id: spell.as_dict() for spell in abilities}
예제 #3
0
    def process_players(self, players_data):
        if not players_data:
            logger.warning("players_data is empty")
            return

        total_damage = players_data.get("damageDone", [])
        total_healing = players_data.get("healingDone", [])

        for composition_data in players_data.get("composition", []):

            spec_data = composition_data.get("specs", [])
            if not spec_data:
                logger.warning("Player has no spec: %s",
                               composition_data.get("name"))
                continue

            spec_data = spec_data[0]
            spec_name = spec_data.get("spec")
            class_name = composition_data.get("type")

            spec = WowSpec.get(name_slug_cap=spec_name,
                               wow_class__name_slug_cap=class_name)
            if not spec:
                logger.warning("Unknown Spec: %s", spec_name)
                continue

            # Get Total Damage or Healing
            spec_role = spec_data.get("role")
            total_data = total_healing if spec_role == "healer" else total_damage
            for data in total_data:
                if data.get("id", -1) == composition_data.get("id"):
                    total = data.get("total", 0) / (self.duration / 1000)
                    break
            else:
                total = 0

            # create and return yield player object
            player = Player()
            player.fight = self
            player.spec_slug = spec.full_name_slug
            player.source_id = composition_data.get("id")
            player.name = composition_data.get("name")
            player.total = int(total)
            player.process_death_events(players_data.get("deathEvents", []))
            self.players[str(player.source_id)] = player

        # call this before filtering to always get the full comp
        self.composition = get_composition(self.players.values())
예제 #4
0
 def spec(self) -> WowSpec:
     return WowSpec.get(full_name_slug=self.spec_slug)
예제 #5
0
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec


################################################################################
# Class
#
HUNTER = WowClass(id=3, name="Hunter", color="#AAD372")

################################################################################
# Specs
#
HUNTER_BEASTMASTERY   = WowSpec(role=RDPS, wow_class=HUNTER,       name="Beast Mastery")
HUNTER_MARKSMANSHIP   = WowSpec(role=RDPS, wow_class=HUNTER,       name="Marksmanship")
HUNTER_SURVIVAL       = WowSpec(role=MDPS, wow_class=HUNTER,       name="Survival")

################################################################################
# Spells
#
HUNTER.add_spell(              spell_id=328231, cooldown=120, duration=15, color=COL_NF,    name="Wild Spirits",        icon="ability_ardenweald_hunter.jpg")
HUNTER.add_spell(              spell_id=308491, cooldown=60,  duration=10, color=COL_KYR,   name="Resonating Arrow",    icon="ability_bastion_hunter.jpg")

HUNTER.add_spell(              spell_id=109304, cooldown=120,                               name="Exhilaration",        icon="ability_hunter_onewithnature.jpg", show=False)
HUNTER.add_buff(               spell_id=186265, cooldown=120,                               name="Aspect of the Turtle",icon="ability_hunter_pet_turtle.jpg", show=False)
HUNTER.add_spell(              spell_id=272679, cooldown=180, duration=6,                   name="Survival of the Fittest", icon="spell_nature_spiritarmor.jpg", show=False, variations=[281195])


HUNTER_BEASTMASTERY.add_spell( spell_id=193530, cooldown=180, duration=20,                  name="Aspect of the Wild",  icon="spell_nature_protectionformnature.jpg")
예제 #6
0
파일: druid.py 프로젝트: gitarrg/lorgs
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec
from lorgs.models.wow_spell import WowSpell


################################################################################
# Class
#
DRUID = WowClass(id=11, name="Druid", color="#FF7C0A")

################################################################################
# Specs
#
DRUID_BALANCE     = WowSpec(role=RDPS, wow_class=DRUID, name="Balance")
DRUID_FERAL       = WowSpec(role=MDPS, wow_class=DRUID, name="Feral")
DRUID_GUARDIAN    = WowSpec(role=TANK, wow_class=DRUID, name="Guardian")
DRUID_RESTORATION = WowSpec(role=HEAL, wow_class=DRUID, name="Restoration", short_name="Resto")

################################################################################
# Spells
#
DRUID.add_spell(             spell_id=323764, cooldown=60,  duration=4,  color=COL_NF,    name="Convoke the Spirits",            icon="ability_ardenweald_druid.jpg")
DRUID.add_spell(             spell_id=323546, cooldown=180, duration=20, color=COL_VENTR, name="Ravenous Frenzy",                icon="ability_revendreth_druid.jpg",              show=False)

# Defensives
DRUID.add_spell(             spell_id=22812, cooldown=60, duration=12, name="Barkskin",                icon="spell_nature_stoneclawtotem.jpg",              show=False)

BEAR_FORM = WowSpell(spell_id=5487, name="Bear Form", icon="ability_racial_bearform.jpg", show=False)
BEAR_FORM.spell_type = DRUID.name_slug
예제 #7
0
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec

################################################################################
# Class
#
WARRIOR = WowClass(id=1, name="Warrior", color="#C69B6D")

################################################################################
# Specs
#
WARRIOR_ARMS = WowSpec(role=MDPS, wow_class=WARRIOR, name="Arms")
WARRIOR_FURY = WowSpec(role=MDPS, wow_class=WARRIOR, name="Fury")
WARRIOR_PROTECTION = WowSpec(role=TANK,
                             wow_class=WARRIOR,
                             name="Protection",
                             short_name="Prot")

################################################################################
# Spells
#
WARRIOR.add_spell(spell_id=324143,
                  cooldown=120,
                  duration=15,
                  color=COL_NECRO,
                  name="Conqueror's Banner",
                  icon="ability_maldraxxus_warriorplantbanner.jpg")
예제 #8
0
파일: rogue.py 프로젝트: gitarrg/lorgs
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec

################################################################################
# Class
#
ROGUE = WowClass(id=4, name="Rogue", color="#FFF468")

################################################################################
# Specs
#
ROGUE_ASSASSINATION = WowSpec(role=MDPS,
                              wow_class=ROGUE,
                              name="Assassination",
                              short_name="Assa")
ROGUE_OUTLAW = WowSpec(role=MDPS, wow_class=ROGUE, name="Outlaw")
ROGUE_SUBTLETY = WowSpec(role=MDPS, wow_class=ROGUE, name="Subtlety")

################################################################################
# Spells
#
ROGUE.add_spell(spell_id=1856,
                cooldown=120,
                color="#999999",
                name="Vanish",
                icon="ability_vanish.jpg",
                show=False)
ROGUE.add_spell(spell_id=323547,
                cooldown=45,
예제 #9
0
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec


################################################################################
# Class
#
SHAMAN = WowClass(id=7, name="Shaman", color="#0070DD")

################################################################################
# Specs
#
SHAMAN_ELEMENTAL   = WowSpec(role=RDPS, wow_class=SHAMAN, name="Elemental")
SHAMAN_ENHANCEMENT = WowSpec(role=MDPS, wow_class=SHAMAN, name="Enhancement")
SHAMAN_RESTORATION = WowSpec(role=HEAL, wow_class=SHAMAN, name="Restoration",   short_name="Resto")

################################################################################
# Spells
#
SHAMAN.add_spell(              spell_id=320674, cooldown=90,               color=COL_VENTR, name="Chain Harvest",              icon="ability_revendreth_shaman.jpg",             show=False)
SHAMAN.add_spell(              spell_id=328923, cooldown=120, duration=3,  color=COL_NF,    name="Fae Transfusion",            icon="ability_ardenweald_shaman.jpg",             show=True)
SHAMAN.add_spell(              spell_id=326059, cooldown=45,               color=COL_NECRO, name="Primordial Wave",            icon="ability_maldraxxus_shaman.jpg",             show=False)

# Defensives
SHAMAN.add_spell(              spell_id=21169,                                              name="Reincarnation",              icon="spell_shaman_improvedreincarnation.jpg",    show=False)
SHAMAN.add_spell(              spell_id=108271, cooldown=90,  duration=12,                  name="Astral Shift",               icon="ability_shaman_astralshift.jpg",            show=False)
SHAMAN.add_buff(               spell_id=337984, cooldown=90,  duration=12,                  name="Vital Accretion",            icon="ability_accretion.jpg",                     show=False)  # Earth Ele HP Increase Conduit
예제 #10
0
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec

################################################################################
# Class
#
DEMONHUNTER = WowClass(id=12, name="Demon Hunter", color="#A330C9")

################################################################################
# Specs
#
DEMONHUNTER_HAVOC = WowSpec(role=MDPS, wow_class=DEMONHUNTER, name="Havoc")
DEMONHUNTER_VENGEANCE = WowSpec(role=TANK,
                                wow_class=DEMONHUNTER,
                                name="Vengeance")

################################################################################
# Spells
#
DEMONHUNTER.add_spell(spell_id=306830,
                      cooldown=60,
                      color=COL_KYR,
                      name="Elysian Decree",
                      icon="ability_bastion_demonhunter.jpg",
                      show=False)
DEMONHUNTER.add_spell(spell_id=323639,
                      cooldown=90,
예제 #11
0
"""Special Utility Role/Class/Spec for things such as trinkets and potions."""
# pylint: disable=bad-whitespace
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_role import WowRole
from lorgs.models.wow_spec import WowSpec


################################################################################
# Role
#
ITEM_ROLE     = WowRole(id=1001, code="item", name="Items")

################################################################################
# Class
#
OTHER         = WowClass(id=1001, name="Other", color="#cccccc")

################################################################################
# "Specs"
#
OTHER_POTION  = WowSpec(role=ITEM_ROLE, wow_class=OTHER, name="Potions")
OTHER_TRINKET = WowSpec(role=ITEM_ROLE, wow_class=OTHER, name="Trinkets")
OTHER_BUFFS = WowSpec(role=ITEM_ROLE, wow_class=OTHER, name="Buffs")
OTHER_RAID = WowSpec(role=ITEM_ROLE, wow_class=OTHER, name="Raid")
예제 #12
0
async def get_spec(spec_slug: str):
    spec = WowSpec.get(full_name_slug=spec_slug)
    if not spec:
        return "Invalid Spec.", 404
    return spec.as_dict()
예제 #13
0
파일: paladin.py 프로젝트: gitarrg/lorgs
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec

################################################################################
# Class
#
PALADIN = WowClass(id=2, name="Paladin", color="#F48CBA")

################################################################################
# Specs
#
PALADIN_HOLY = WowSpec(role=HEAL, wow_class=PALADIN, name="Holy")
PALADIN_PROTECTION = WowSpec(role=TANK,
                             wow_class=PALADIN,
                             name="Protection",
                             short_name="Prot")
PALADIN_RETRIBUTION = WowSpec(role=MDPS,
                              wow_class=PALADIN,
                              name="Retribution",
                              short_name="Ret")

################################################################################
# Spells
#
PALADIN.add_spell(spell_id=304971,
                  cooldown=60,
                  color=COL_KYR,
예제 #14
0
파일: mage.py 프로젝트: gitarrg/lorgs
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec


################################################################################
# Class
#
MAGE = WowClass(id=8, name="Mage", color="#3FC7EB")

################################################################################
# Specs
#
MAGE_ARCANE = WowSpec(role=RDPS, wow_class=MAGE, name="Arcane")
MAGE_FIRE   = WowSpec(role=RDPS, wow_class=MAGE, name="Fire")
MAGE_FROST  = WowSpec(role=RDPS, wow_class=MAGE, name="Frost")

################################################################################
# Spells
#

# Covenant & Shared
MAGE.add_spell(        spell_id=314793, cooldown=90,  duration=25, color=COL_VENTR, name="Mirrors of Torment", icon="ability_revendreth_mage.jpg")
MAGE.add_spell(        spell_id=314791, cooldown=60,  duration=3,  color=COL_NF,    name="Shifting Power",     icon="ability_ardenweald_mage.jpg",               show=False)
MAGE.add_spell(        spell_id=307443, cooldown=30,  duration=10, color=COL_KYR,   name="Radiant Spark",      icon="ability_bastion_mage.jpg",                  show=False)
MAGE.add_spell(        spell_id=324220, cooldown=180, duration=25, color=COL_NECRO, name="Deathborne",         icon="ability_maldraxxus_mage.jpg")


# Defensives
예제 #15
0
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec
from lorgs.models.wow_spell import WowSpell

################################################################################
# Class
#
DEATHKNIGHT = WowClass(id=6, name="Death Knight", color="#C41E3A")

################################################################################
# Specs
#
DEATHKNIGHT_BLOOD = WowSpec(role=TANK, wow_class=DEATHKNIGHT, name="Blood")
DEATHKNIGHT_FROST = WowSpec(role=MDPS, wow_class=DEATHKNIGHT, name="Frost")
DEATHKNIGHT_UNHOLY = WowSpec(role=MDPS, wow_class=DEATHKNIGHT, name="Unholy")

################################################################################
# Spells
#
DEATHKNIGHT.add_spell(spell_id=312202,
                      cooldown=60,
                      duration=14,
                      color=COL_KYR,
                      name="Shackle the Unworthy",
                      icon="ability_bastion_deathknight.jpg",
                      show=False)
DEATHKNIGHT.add_spell(spell_id=311648,
                      cooldown=60,
예제 #16
0
파일: warlock.py 프로젝트: gitarrg/lorgs
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec
from lorgs.models.wow_spell import WowSpell

################################################################################
# Class
#
WARLOCK = WowClass(id=9, name="Warlock", color="#8788EE")

################################################################################
# Specs
#
WARLOCK_AFFLICTION = WowSpec(role=RDPS,
                             wow_class=WARLOCK,
                             name="Affliction",
                             short_name="Aff")
WARLOCK_DEMONOLOGY = WowSpec(role=RDPS,
                             wow_class=WARLOCK,
                             name="Demonology",
                             short_name="Demo")
WARLOCK_DESTRUCTION = WowSpec(role=RDPS,
                              wow_class=WARLOCK,
                              name="Destruction",
                              short_name="Destro")

################################################################################
# Spells
#
WARLOCK.add_spell(spell_id=325640,
                  cooldown=60,
예제 #17
0
파일: monk.py 프로젝트: gitarrg/lorgs
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec
from lorgs.models.wow_spell import WowSpell

################################################################################
# Class
#
MONK = WowClass(id=10, name="Monk", color="#00FF98")

################################################################################
# Specs
#
MONK_BREWMASTER = WowSpec(role=TANK, wow_class=MONK, name="Brewmaster")
MONK_MISTWEAVER = WowSpec(role=HEAL, wow_class=MONK, name="Mistweaver")
MONK_WINDWALKER = WowSpec(role=MDPS, wow_class=MONK, name="Windwalker")

################################################################################
# Spells
#
MONK.add_spell(spell_id=310454,
               cooldown=120,
               duration=30,
               color=COL_KYR,
               name="Weapons of Order",
               icon="ability_bastion_monk.jpg",
               show=False)
MONK.add_spell(spell_id=325216,
               cooldown=60,
예제 #18
0
파일: priest.py 프로젝트: gitarrg/lorgs
# IMPORT LOCAL LIBRARIES
from lorgs.data.constants import *
from lorgs.data.roles import *
from lorgs.models.wow_class import WowClass
from lorgs.models.wow_spec import WowSpec

########################################################################################################################
# Class
#
PRIEST = WowClass(id=5, name="Priest", color="#FFFFFF")

########################################################################################################################
# Specs
#
PRIEST_DISCIPLINE = WowSpec(role=HEAL,
                            wow_class=PRIEST,
                            name="Discipline",
                            short_name="Disc")
PRIEST_HOLY = WowSpec(role=HEAL, wow_class=PRIEST, name="Holy")
PRIEST_SHADOW = WowSpec(role=RDPS, wow_class=PRIEST, name="Shadow")

################################################################################
# Class
#
PRIEST.add_spell(spell_id=325013,
                 cooldown=180,
                 duration=10,
                 color=COL_KYR,
                 name="Boon of the Ascended",
                 icon="ability_bastion_priest.jpg")
PRIEST.add_spell(spell_id=324724,
                 cooldown=60,