示例#1
0
def region_healers(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 healer_str, healer_int in sorted(combat['healer_list']):
        graph_list = []
        graph_list.append(Graph([('vbar', color_dict[toon_dict[healer_str]['class']][2])],
                lambda timeline, index: timeline.getEventData(index, 'count(*)', suffix=('_CAST_START', '_CAST_SUCCESS'), sourceName=healer_str).fetchone()[0] != 0,
                smoothing=None))
        region_list.append(Region(timeline, ("%s: %s" % (healer_str, healer_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=healer_str))
        region_list.append(Region(timeline, "Auras", graph_list, len(timeline), 15, region_list[-1], 'under'))

        graph_list = []
        graph_list.append(Graph([('upbar', css('heal_pc_inst'))],
                lambda timeline, index: timeline.getEventData(index, 'sum(amount) - sum(extra)', suffix='_HEAL', destType='PC', sourceType='PC', sourceName=healer_str).fetchone()[0] or 0,
                smoothing=None))
        region_list.append(Region(timeline, "  Healing", graph_list, len(timeline), 0.005, region_list[-1], 'under'))

        graph_list = []
        graph_list.append(Graph([('downbar', css('overheal_pc_inst'))],
                lambda timeline, index: timeline.getEventData(index, 'sum(extra)', suffix='_HEAL', destType='PC', sourceType='PC', sourceName=healer_str).fetchone()[0] or 0,
                smoothing=None))
        region_list.append(Region(timeline, "  Overhealing", graph_list, len(timeline), 0.005, region_list[-1], 'under', True))
示例#2
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))
示例#3
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))
示例#4
0
    def impl(self, options):
        conn = self.conn
#
#
#def main(sys_argv, options, arguments):
#    try:
#        stasisutils.main(sys_argv, options, arguments)
#        conn = basicparse.sqlite_connection(options)
        
        if options.css_str:
            load_css(options.css_str)
        
        #print datetime.datetime.now(), "Iterating over combat images..."
        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'])
            
            time_list = [x['time'] for x in conn_execute(conn, '''select time from event where combat_id = ?''', (combat['id'],)).fetchall()]
            start_dt = min(time_list)
            end_dt = max(time_list)
            
            timeline = Timeline(conn, start_dt, end_dt, width=0.5)
    
            if combat['stasis_path']:
                stasisutils.removeImages(conn, combat)
                    
            file_list = []
            file_list.append(re.sub('[^a-zA-Z0-9_-]', '_', combat['instance']))
            file_list.append(re.sub('[^a-zA-Z0-9_-]', '_', combat['encounter']))
            file_list.append(re.sub('[^a-zA-Z0-9_-]', '_', str(timeline.start_dt)).rsplit('.', 1)[0].replace(':', '-'))
            file_list.append('%s')
            
            file_base = '_'.join(file_list) + '.png'
            
            print datetime.datetime.now(), "Rendering: %s" % (file_base % '...')
                
            for type_str in ('damage_out', 'healing', 'damage_in'):
                if combat['stasis_path']:
                    file_path = os.path.join(combat['stasis_path'], file_base % type_str)
                    stasisutils.addImage(conn, combat, file_path, type_str)
                elif options.stasis_path:
                    file_path = os.path.join(options.stasis_path, file_base % type_str)
                
                
                region_list = []
                region_title(conn, combat, timeline, region_list, options)
                region_bossDpsHealing(conn, combat, timeline, region_list, options)
                if type_str == 'damage_out':
                    region_dps(conn, combat, timeline, region_list, options)
                if type_str == 'healing':
                    region_healers(conn, combat, timeline, region_list, options)
                
                image = Image.new('RGB', (int(region_list[0].getRight()), int(max([x.getBottom() for x in region_list]))), css('background'))
                draw = ImageDraw.Draw(image)
        
                for region in region_list:
                    region.render(draw)
                
                image.save(file_path)
示例#5
0
 def render(self, draw, region):
     if not self.index_list:
         return
     
     span_index = 0
     for index in self.index_list:
         #if index > self.index_list[span_index][1]:
         #    span_index += 1
         #if span_index > len(self.index_list):
         #    return
         
         #if index > self.index_list[span_index][0]:
             if self.limit:
                 draw.line([(index + region.getLeft(), region.getBottom()), (index + region.getLeft(), region.getTop())], fill=css(self.css_str))
             else:
                 draw.line([(index + region.getLeft(), 10000), (index + region.getLeft(), 0)], fill=css(self.css_str))
             
     if self.label:
         last = -2
         for index in self.index_list:
             if index != last+1:
                 draw.text((region.getLeft() + index + 5, region.getTop() + 3), self.label, font=ImageFont.load_default(), fill=css('text.' + self.css_str))
             last = index
示例#6
0
 def render(self, draw, region):
     start_dt = region.timeline.start_dt
     
     tick_td = datetime.timedelta(seconds=10)
     
     if region.timeline.width_td.seconds < 1:
         next_dt = start_dt + tick_td
         for i in range(len(region.timeline)):
             if region.timeline.containsTime(next_dt, i):
                 draw.line([(i + region.getLeft(), 10000), (i + region.getLeft(), 0)], fill=css('time.second'))
                 next_dt += tick_td
                 
     tick_td = datetime.timedelta(seconds=60)
     
     next_dt = start_dt + tick_td
     for i in range(len(region.timeline)):
         if region.timeline.containsTime(next_dt, i):
             draw.line([(i + region.getLeft(), 10000), (i + region.getLeft(), 0)], fill=css('time.minute'))
             next_dt += tick_td
示例#7
0
 def render(self, draw):
     tmp_list = list(self.graph_list)
     tmp_list.reverse()
     for graph in tmp_list:
         #print "..."
         graph.render(draw, self)
         
     if self.label_str:
         draw.text((self.getLeft() -95, self.getTop() + 3), self.label_str, font=ImageFont.load_default(), fill=css('text.regionTitle'))
     if self.border:
         draw.line([(0, self.getBottom()), (self.getRight(), self.getBottom())], fill=css('region_border'))