def calculate(self): # bugged if not self.initializing: gear_stats = self.gear_page.get_stats() my_stats = stats.Stats(**gear_stats) my_talents = talents.Talents( talent_string='311113') #(*self.talents_page.get_talents() ) #my_talents = '311113' my_glyphs = glyphs.Glyphs('rogue', *self.talents_page.get_glyphs( )) #.RogueGlyphs(*self.talents_page.get_glyphs()) my_buffs = buffs.Buffs(*self.buffs_page.current_buffs) my_race = race.Race(self.settings_page.get_race()) test_settings = settings.Settings( self.settings_page.get_cycle(), response_time=self.settings_page.get_response_time()) self.error_area.SetLabel("") try: calculator = AldrianasRogueDamageCalculator( my_stats, my_talents, my_glyphs, my_buffs, my_race, test_settings) dps = calculator.get_dps() ep_values = calculator.get_ep() dps_breakdown = calculator.get_dps_breakdown() except exceptions.InvalidInputException as e: self.error_area.SetLabel(str(e)) self.dps.SetValue(str(dps)) self.ep_box.SetValue(self.pretty_print(ep_values)) self.dps_breakdown.SetValue(self.pretty_print(dps_breakdown)) for stat in GearPage.stats: tc = getattr(self, stat) tc.SetValue(str(gear_stats[stat]))
def make_calculator(self, buffs_list=[], gear_buffs_list=[], race_name='night_elf'): test_buffs = buffs.Buffs(*buffs_list) test_gear_buffs = stats.GearBuffs(*gear_buffs_list) test_procs = procs.ProcsList() test_mh = stats.Weapon(737, 1.8, 'dagger', 'hurricane') test_oh = stats.Weapon(573, 1.4, 'dagger', 'hurricane') test_ranged = stats.Weapon(1104, 2.0, 'thrown') test_stats = stats.Stats(20, 3485, 190, 1517, 1086, 641, 899, 666, test_mh, test_oh, test_ranged, test_procs, test_gear_buffs) test_race = race.Race(race_name) test_talents = None test_glyphs = glyphs.Glyphs() return calcs.DamageCalculator(test_stats, test_talents, test_glyphs, test_buffs, test_race)
# Set up gear buffs. test_gear_buffs = stats.GearBuffs('rogue_t14_2pc', 'rogue_t14_4pc', 'leather_specialization', 'vermins_bite', 'chaotic_metagem') # Set up a calcs object.. # str, agi, ap, crit, hit, exp, haste, mast, mh, oh, procs, gear_buffs test_stats = stats.Stats(80, 18000, 250, 2000, 2550, 2550, 4000, 4800, test_mh, test_oh, test_procs, test_gear_buffs) # Initialize talents.. test_talents = talents.Talents('322213', test_class, test_level) # Set up glyphs. glyph_list = ['recuperate'] test_glyphs = glyphs.Glyphs(test_class, *glyph_list) # Set up settings. test_cycle = settings.CombatCycle() test_settings = settings.Settings(test_cycle, response_time=1) # Build a DPS object. calculator = AldrianasRogueDamageCalculator(test_stats, test_talents, test_glyphs, test_buffs, test_race, test_settings, test_level) # Compute EP values. ep_values = calculator.get_ep() # Compute DPS Breakdown. dps_breakdown = calculator.get_dps_breakdown()
def setup(self, input): gear_data = input.get("g", []) gear = frozenset([x[0] for x in gear_data]) i18n.set_language('local') # Base _level = int(input.get("l", 100)) # Buffs buff_list = [] __max = len(self.buffMap) for b in input.get("b", []): b = int(b) if b >= 0 and b < __max: buff_list.append(self.buffMap[b]) # Buff Food buff_list.append(self.buffFoodMap[input.get("bf", 0)]) _buffs = buffs.Buffs(*buff_list, level=_level) # ################################################################################## # Weapons _mh = self.weapon(input, 'mh') _oh = self.weapon(input, 'oh') # ################################################################################## # ################################################################################## # Set up gear buffs. buff_list = [] buff_list.append('gear_specialization') if input.get("mg") == "chaotic": buff_list.append('chaotic_metagem') if len(self.tier14IDS & gear) >= 2: buff_list.append('rogue_t14_2pc') if len(self.tier14IDS & gear) >= 4: buff_list.append('rogue_t14_4pc') if len(self.tier15IDS & gear) >= 2: buff_list.append('rogue_t15_2pc') if len(self.tier15IDS & gear) >= 4: buff_list.append('rogue_t15_4pc') if len(self.tier16IDS & gear) >= 2: buff_list.append('rogue_t16_2pc') if len(self.tier16IDS & gear) >= 4: buff_list.append('rogue_t16_4pc') if len(self.tier17IDS & gear) >= 2: buff_list.append('rogue_t17_2pc') if len(self.tier17IDS & gear) >= 4: buff_list.append('rogue_t17_4pc') if len(self.tier17LFRIDS & gear) >= 4: buff_list.append('rogue_t17_4pc_lfr') agi_bonus = 0 if len(self.tier17LFRIDS & gear) >= 2: agi_bonus += 100 for k in self.gearBoosts: if k in gear: buff_list.append(self.gearBoosts[k]) _gear_buffs = stats.GearBuffs(*buff_list) # ################################################################################## # Trinket procs proclist = [] for k in self.gearProcs: if k in gear: for gd in gear_data: if gd[0] == k: proclist.append((self.gearProcs[k], gd[1])) break if input.get("mg") == "capacitive": proclist.append('legendary_capacitive_meta') #if len(frozenset([102248]) & gear) >= 1: # proclist.append('fury_of_xuen') if input.get("l", 0) == 90: if input.get("prepot", 0) == 1: proclist.append('virmens_bite_prepot') if input.get("pot", 0) == 1: proclist.append('virmens_bite') elif input.get("l", 0) > 90: if input.get("prepot", 0) == 1: proclist.append('draenic_agi_prepot') if input.get("pot", 0) == 1: proclist.append('draenic_agi_pot') _procs = procs.ProcsList(*proclist) # ################################################################################## # Player stats # Need parameter order here # str, agi, int, spi, sta, ap, crit, hit, exp, haste, mastery, mh, oh, thrown, procs, gear buffs raceStr = input.get("r", 'human').lower().replace(" ", "_") _race = race.Race(raceStr, 'rogue', _level) s = input.get("sta", {}) _opt = input.get("settings", {}) duration = int(_opt.get("duration", 300)) _stats = stats.Stats( _mh, _oh, _procs, _gear_buffs, s[0], # Str s[1] + agi_bonus, # AGI 0, 0, 0, s[2], # AP s[3], # Crit s[4], # Haste s[5], # Mastery 0, s[6], # Multistrike s[7], # Versatility _level, s[9], # PvP Power s[8], # Resilience Rating pvp_target_armor=_opt.get("pvp_target_armor", 1500)) # ################################################################################## # Talents t = input.get("t", '') _talents = talents.Talents(t, "rogue", _level) # Glyphs _glyphs = glyphs.Glyphs("rogue", *input.get("gly", [])) _spec = input.get("spec", 'a') if _spec == "a": tree = 0 elif _spec == "Z": tree = 1 else: tree = 2 rotation_keys = input.get("ro", { 'opener_name': 'default', 'opener_use': 'always' }) if not rotation_keys["opener_name"] in self.validOpenerKeys[tree]: rotation_keys["opener_name"] = "default" rotation_options = dict((key.encode('ascii'), val) for key, val in self.convert_bools( input.get("ro", {})).iteritems() if key in self.validCycleKeys[tree]) settings_options = {} if __builtin__.shadowcraft_engine_version >= 5.4: settings_options['num_boss_adds'] = _opt.get("num_boss_adds", 0) if __builtin__.shadowcraft_engine_version >= 6.0: settings_options['is_day'] = _opt.get("night_elf_racial", 0) == 1 if tree == 0: _cycle = settings.AssassinationCycle(**rotation_options) elif tree == 1: _cycle = settings.CombatCycle(**rotation_options) else: _cycle = settings.SubtletyCycle(5, **rotation_options) # test_settings = settings.Settings(test_cycle, response_time=.5, duration=360, dmg_poison='dp', utl_poison='lp', is_pvp=charInfo['pvp'], shiv_interval=charInfo['shiv']) _settings = settings.Settings( _cycle, time_in_execute_range=_opt.get("time_in_execute_range", 0.35), response_time=_opt.get("response_time", 0.5), duration=duration, dmg_poison=_opt.get("dmg_poison", 'dp'), utl_poison=_opt.get("utl_poison", None), opener_name=rotation_keys["opener_name"], use_opener=rotation_keys["opener_use"], is_pvp=_opt.get("pvp", False), latency=_opt.get("latency", 0.03), adv_params=_opt.get("adv_params", ''), default_ep_stat='ap', **settings_options) calculator = AldrianasRogueDamageCalculator(_stats, _talents, _glyphs, _buffs, _race, _settings, _level) return calculator