Example #1
0
def instanceByMob(npc_str):
    for instance, instance_dict in instanceData().items():
        for encounter, encounter_dict in instance_dict.items():
            if npc_str in encounter_dict['boss']:
                return instance
            if npc_str in encounter_dict['mobs']:
                return instance
Example #2
0
def getMobs():
    mobs_list = []
    
    for instance, instance_dict in instanceData().items():
        for encounter, encounter_dict in instance_dict.items():
            mobs_list.extend(encounter_dict['mobs'])
            
    return mobs_list
Example #3
0
def getBossMobs():
    boss_list = []
    
    for instance, instance_dict in instanceData().items():
        for encounter, encounter_dict in instance_dict.items():
            boss_list.extend(encounter_dict['boss'])
            
    return boss_list
Example #4
0
def region_bossDpsHealing(conn, combat, timeline, region_list, options):
    graph_list = []
    graph_list.append(Graph([('upline', css('heal_boss'))],
            lambda timeline, index: timeline.getEventData(index, 'sum(amount) - sum(extra)', suffix='_HEAL', destType=('NPC','Mount')).fetchone()[0] or 0,
            smoothing=[3,3,3,5]))
    graph_list.append(Graph([('upbar', css('dps_boss_bar')), ('upline', css('dps_boss_trend'))],
            lambda timeline, index: timeline.getEventData(index, 'sum(amount) - sum(extra)', suffix='_DAMAGE', sourceType=('PC','Pet'), destType=('NPC','Mount'), \
                                                          destName=tuple(instanceData()[combat['instance']][combat['encounter']]['boss'])).fetchone()[0] or 0,
            smoothing=[3,3,3,5]))
    graph_list.append(Graph([('upbar', css('dps_trash_bar')), ('upline', css('dps_trash_trend'))],
            lambda timeline, index: timeline.getEventData(index, 'sum(amount) - sum(extra)', suffix='_DAMAGE', sourceType=('PC','Pet'), destType=('NPC','Mount')).fetchone()[0] or 0,
            smoothing=[3,3,3,5]))
    region_list.append(Region(timeline, "Player DPS / Boss Healing", graph_list, len(timeline), 0.005, region_list[-1], 'under', True))
Example #5
0
    def impl(self, options):
        conn = self.conn
        
        #conn_execute(conn, '''drop table if exists execution''')
        conn_execute(conn, '''create table execution (id integer primary key, date_str str, type str, combat_id int, typeName str, toonName str, value float default 0.0, normalizedValue float default 0.0)''')
        conn_execute(conn, '''create index ndx_execution_which on execution (toonName, type, combat_id, typeName)''')
        conn_execute(conn, '''create index ndx_execution_when on execution (date_str, type, combat_id, typeName, toonName)''')

        overall_dict = {}
        date_str = None
        
        #print datetime.datetime.now(), "Iterating over combats (finding execution failures)..."
        for combat in conn_execute(conn, '''select * from combat order by start_event_id''').fetchall():
            print datetime.datetime.now(), "Combat %d: %s - %s" % (combat['id'], combat['instance'], combat['encounter'])
            start_dt = conn_execute(conn, '''select time from event where id = ?''', (combat['start_event_id'],)).fetchone()[0]
            end_dt = conn_execute(conn, '''select time from event where id = ?''', (combat['end_event_id'],)).fetchone()[0]
            
            if not date_str:
                date_str = start_dt.strftime("%Y-%m-%d")
            
            if (end_dt - start_dt) >= datetime.timedelta(seconds=110):
                for fail_str, args_dict in instanceData()[combat['instance']][combat['encounter']].get('execution', {}).items():
                    fail_dict = globals().get(args_dict['type'])(conn, combat, **dict([(str(k), v) for k,v in args_dict.items()]))
                    
                    for toonName, value in sorted(fail_dict.items(), key=lambda x: (-x[1], x[0])):
                        conn_execute(conn, '''insert into execution (date_str, type, combat_id, typeName, toonName, value) values (?,?,?,?,?,?)''',
                                (date_str, 'fail', combat['id'], fail_str, toonName, value))

        for row in conn_execute(conn, '''select typeName, max(value) maxValue from execution where type = ? group by typeName''', ('fail',)).fetchall():
            if row['maxValue'] > 0.0:
                conn_execute(conn, '''update execution set normalizedValue = value / ? where type = ? and typeName = ?''', (row['maxValue'], 'fail', row['typeName']))

        #            #for k,v in sorted(fail_dict.items(), key=lambda x: (-x[1], x[0])):
        #            #    print combat['id'], combat['encounter'], fail_str, k, v
        #                
        #            overall_dict.setdefault((combat['instance'], combat['encounter'], fail_str), [])
        #            overall_dict[(combat['instance'], combat['encounter'], fail_str)].append(fail_dict)
        #        
        #for key in sorted(overall_dict):
        #    for k,v in sorted(normalize(avgDictsPerKey(overall_dict[key])).items(), key=lambda x: (-x[1], x[0])):
        #        print "overall", key, k, v
        #        
        #        conn_execute(conn, '''insert into execution (instance, encounter, typeName, toonName, value, date_str) values (?,?,?,?,?,?)''', key + (k, v, date_str))
        conn.commit()
Example #6
0
def region_dps(conn, combat, timeline, region_list, options):
    toon_dict = armoryutils.sqlite_scrapeCharacters(options.armorydb_path, [], options.realm_str, options.region_str)
    color_dict = armoryutils.classColors()
    
    for dps_str, dps_int in combat['dps_list']:
        graph_list = []
        graph_list.append(Graph([('vbar', color_dict[toon_dict[dps_str]['class']][2])],
                lambda timeline, index: timeline.getEventData(index, 'count(*)', suffix=('_CAST_START', '_CAST_SUCCESS'), sourceName=dps_str).fetchone()[0] != 0,
                smoothing=None))
        region_list.append(Region(timeline, ("%s: %s" % (dps_str, dps_int)), graph_list, len(timeline), 15, region_list[-1], 'under'))

        graph_list = []
        graph_list.append(AuraGraph(combat, "Mark of the Faceless", "MotF", True, destType='PC', destName=dps_str))
        region_list.append(Region(timeline, "Auras", graph_list, len(timeline), 15, region_list[-1], 'under'))

        graph_list = []
        graph_list.append(Graph([('upbar', css('dps_boss_bar')), ('upline', css('dps_boss_trend'))],
                lambda timeline, index: timeline.getEventData(index, 'sum(amount) - sum(extra)', suffix='_DAMAGE', sourceType=('PC','Pet'), destType=('NPC','Mount'), sourceName=dps_str, \
                                                              destName=tuple(instanceData()[combat['instance']][combat['encounter']]['boss'])).fetchone()[0] or 0,
                smoothing=[3,3,3,5]))
        graph_list.append(Graph([('upbar', css('dps_trash_bar')), ('upline', css('dps_trash_trend'))],
                lambda timeline, index: timeline.getEventData(index, 'sum(amount) - sum(extra)', suffix='_DAMAGE', sourceType=('PC','Pet'), destType=('NPC','Mount'), sourceName=dps_str).fetchone()[0] or 0,
                smoothing=[3,3,3,5]))
        region_list.append(Region(timeline, "  Damage", graph_list, len(timeline), 0.005, region_list[-1], 'under', True))
Example #7
0
def getStasisName(instance, encounter):
    data_dict = instanceData()[instance][encounter]
    
    return data_dict.get('stasis', re.sub('[^a-z]', '', encounter.lower()))