示例#1
0
    def get_detailed_dpm(
            self,
            spec_name: str = "8000",
            cdr: int = 0,
            ulevel: int = 6000,
            options={}
    ) -> Dict[str, Any]:
        gen: JobGenerator = self.supplier.JobGenerator()
        target, weapon_stat = TemplateGenerator().get_template_and_weapon_stat(gen=gen, spec_name=spec_name, cdr=cdr)

        # 코어강화량 설정
        v_builder = core.AlwaysMaximumVBuilder()
        graph = gen.package(
            target,
            v_builder,
            options=options,
            ulevel=ulevel,
            weaponstat=weapon_stat,
            ability_grade=Ability_grade(4, 1),
        )
        # 가져온 그래프를 토대로 스케줄러를 생성합니다.
        sche = policy.AdvancedGraphScheduler(
            graph,
            policy.TypebaseFetchingPolicy(
                priority_list=[
                    core.BuffSkillWrapper,
                    core.SummonSkillWrapper,
                    core.DamageSkillWrapper,
                ]
            ),
            [rules.UniquenessRule()] + gen.get_predefined_rules(rules.RuleSet.BASE),
        )
        # 데이터를 분석할 분석기를 생성합니다.
        analytics = core.Analytics()
        # 시뮬레이터에 스케줄러, 캐릭터, 애널리틱을 연결하고 생성합니다.
        control = core.Simulator(
            sche, target, analytics
        )
        control.start_simulation(self.runtime)

        return {
            "data": analytics.get_results(),
            "meta": analytics.get_metadata(target.get_buffed_modifier()),
            "skill": analytics.get_skill_info(),
            "graph": graph.get_network_information("merged"),
            "dpm": analytics.getDPM(),
            "detail": gen.generate.__doc__,
            "loss": analytics.get_unrestricted_DPM() - analytics.getDPM(),
        }
示例#2
0
def burst10(args):
    preset = get_preset(args.id)
    gen: JobGenerator = jobMap[preset.job].JobGenerator()
    target, weapon_stat = TemplateGenerator().get_template_and_weapon_stat(
        gen, str(args.ulevel), args.cdr)
    v_builder = core.AlwaysMaximumVBuilder()
    graph = gen.package(
        target,
        v_builder,
        options=preset.options,
        ulevel=args.ulevel,
        weaponstat=weapon_stat,
        ability_grade=Ability_grade(4, 1),
    )
    sche = policy.AdvancedGraphScheduler(
        graph,
        policy.ListedFetchingPolicy(
            skill_ids=gen.get_skill_rotation_10sec(graph)),
        [rules.UniquenessRule()],
    )
    analytics = core.StatAnalytics()
    control = core.Simulator(sche, target, analytics)
    control.start_simulation(args.time * 1000)
    start, end, dpm, loss = analytics.get_peak(10000)
    print(preset.job, f"{dpm:,.3f}")

    return analytics.get_log()
示例#3
0
def dpm(args):
    preset = get_preset(args.id)
    gen: JobGenerator = jobMap[preset.job].JobGenerator()
    target, weapon_stat = TemplateGenerator().get_template_and_weapon_stat(
        gen, str(args.ulevel), args.cdr)
    v_builder = core.AlwaysMaximumVBuilder()
    graph = gen.package(
        target,
        v_builder,
        options=preset.options,
        ulevel=args.ulevel,
        weaponstat=weapon_stat,
        ability_grade=Ability_grade(4, 1),
    )
    sche = policy.AdvancedGraphScheduler(
        graph,
        policy.TypebaseFetchingPolicy(priority_list=[
            core.BuffSkillWrapper,
            core.SummonSkillWrapper,
            core.DamageSkillWrapper,
        ]),
        [rules.UniquenessRule()] +
        gen.get_predefined_rules(rules.RuleSet.BASE),
    )
    analytics = core.StatAnalytics()
    control = core.Simulator(sche, target, analytics)
    control.start_simulation(args.time * 1000)
    dpm = analytics.get_dpm()
    print(preset.job, f"{dpm:,.3f}")

    return analytics.get_log()
    def get_dpm(
            self,
            spec_name: str,
            ulevel: int,
            cdr: int = 0,
            options={},
            printFlag=False,
            statistics=False,
            restricted=True,
            default_modifier=core.CharacterModifier(),
    ) -> float:
        gen: JobGenerator = self.supplier.JobGenerator()
        target, weapon_stat = TemplateGenerator().get_template_and_weapon_stat(
            gen=gen, spec_name=spec_name, cdr=cdr)

        v_builder = core.AlwaysMaximumVBuilder()
        graph = gen.package(
            target,
            v_builder,
            options=options,
            ulevel=ulevel,
            weaponstat=weapon_stat,
            ability_grade=Ability_grade(4, 1),
            farm=False,
        )
        sche = policy.AdvancedGraphScheduler(
            graph,
            policy.TypebaseFetchingPolicy(priority_list=[
                core.BuffSkillWrapper,
                core.SummonSkillWrapper,
                core.DamageSkillWrapper,
            ]),
            [rules.UniquenessRule()] +
            gen.get_predefined_rules(rules.RuleSet.BASE),
        )  # 가져온 그래프를 토대로 스케줄러를 생성합니다.
        analytics = core.Analytics(printFlag=printFlag)  # 데이터를 분석할 분석기를 생성합니다.
        if printFlag:
            print(target.get_modifier())
        control = core.Simulator(
            sche, target, analytics)  # 시뮬레이터에 스케줄러, 캐릭터, 애널리틱을 연결하고 생성합니다.
        control.set_default_modifier(default_modifier)
        control.start_simulation(self.runtime)
        if statistics:
            control.analytics.statistics()
        return analytics.getDPM(restricted=restricted)
def test_job_generator_creation():
    with open('../dpmModule/jobs/configs/archmageFb.json', encoding='utf-8') as f:
        test_conf = json.load(f)
    vEhc = None
    gen = JobGenerator()
    gen.load(test_conf)
    character = TemplateGenerator().get_template(gen, "8000")
    passive_skill_list = gen.get_passive_skill_list(vEhc, character, None)
    not_implied_skill_list = gen.get_not_implied_skill_list(vEhc, character, None)
    print(passive_skill_list)
    print(not_implied_skill_list)
示例#6
0
def get_modifier(args) -> core.CharacterModifier:
    preset = get_preset(args.id)
    gen: JobGenerator = jobMap[preset.job].JobGenerator()
    target, weapon_stat = TemplateGenerator().get_template_and_weapon_stat(gen, str(args.ulevel), args.cdr)
    v_builder = core.AlwaysMaximumVBuilder()
    gen.package(
        target,
        v_builder,
        options=preset.options,
        ulevel=args.ulevel,
        weaponstat=weapon_stat,
        ability_grade=Ability_grade(4, 1),
        farm=False,
    )
    return gen.get_passive_skill_modifier()
示例#7
0
class DpmInterface:
    def __init__(self):
        self.template_generator = TemplateGenerator()

    def calculate_every(self) -> List[Dict[str, Any]]:
        settings = []
        for spec_name in self.template_generator.get_spec_names():
            settings.append(DpmSetting(ulevel=int(spec_name)))

        retval = [
            {"data": setting.process(), "prefix": "u" + str(setting.ulevel)}
            for setting in settings
        ]
        return retval

    def calculate(
            self,
            ulevel: int,
            restricted=True,
            default_modifier=core.CharacterModifier()
    ) -> Dict[str, Any]:
        setting = DpmSetting(ulevel=ulevel)
        return {
            "data": setting.process(
                restricted=restricted, default_modifier=default_modifier
            ),
            "prefix": "u" + str(setting.ulevel),
        }

    def calculate_job(
            self,
            koJob: str,
            ulevel: int,
            runtime: int = 180 * 1000
    ) -> Dict[str, Any]:
        setting = DpmSetting(ulevel=ulevel)

        return setting.processJob(koJob, runtime=runtime)
 def __init__(self):
     self.template_generator = TemplateGenerator()