Exemplo n.º 1
0
    def make_new_panel(self, reset_time=True, is_first_time=False):
        panel = MongoHeroPanel()
        panel.id = self.char_id

        if reset_time:
            panel.last_refresh = arrow.utcnow().timestamp
        else:
            panel.last_refresh = self.panel.last_refresh

        if is_first_time:
            panel.refresh_times = 0
            heros = self._first_time_hero_lists()
        else:
            panel.refresh_times += 1
            heros = self._other_times_hero_list()

        embedded_hero_objs = []
        for oid, good in heros:
            embedded_hero_objs.append(
                MongoEmbeddedHeroPanelHero(oid=oid, good=good, opened=False))

        for index, i in enumerate(embedded_hero_objs):
            panel.panel[str(index + 1)] = i

        panel.save()
        return panel
Exemplo n.º 2
0
    def make_new_panel(self, reset_time=True, is_first_time=False):
        panel = MongoHeroPanel()
        panel.id = self.char_id

        if reset_time:
            panel.last_refresh = arrow.utcnow().timestamp
        else:
            panel.last_refresh = self.panel.last_refresh

        if is_first_time:
            panel.refresh_times = 0
            heros = self._first_time_hero_lists()
        else:
            panel.refresh_times += 1
            heros = self._other_times_hero_list()

        embedded_hero_objs = []
        for oid, good in heros:
            embedded_hero_objs.append(
                MongoEmbeddedHeroPanelHero(oid=oid, good=good, opened=False)
            )

        for index, i in enumerate(embedded_hero_objs):
            panel.panel[str(index+1)] = i

        panel.save()
        return panel
Exemplo n.º 3
0
    def make_new_panel(self, reset_time=True):
        panel = MongoHeroPanel()
        panel.id = self.char_id
        panel.got_good_hero = False

        if reset_time:
            panel.last_refresh = timezone.utc_timestamp()
        else:
            panel.last_refresh = self.panel.last_refresh

        good_hero_amount = 1
        if random.randint(1, 100) <= GET_HERO_TWO_QUALITY_ONE_HEROS:
            good_hero_amount = 2

        heros = []

        while len(heros) < good_hero_amount:
            choose_good_hero = random.choice(GET_HERO_QUALITY_ONE_POOL)
            if choose_good_hero not in heros:
                heros.append(choose_good_hero)

        while len(heros) < 6:
            choose_other_hero = random.choice(MERGED_OTHER_HERO_POOL)
            if choose_other_hero not in heros:
                heros.append(choose_other_hero)

        embedded_hero_objs = []
        embedded_hero_objs.append(
            MongoEmbeddedHeroPanelHero(oid=heros[0], good=True, opened=False)
        )
        for h in heros[1:]:
            embedded_hero_objs.append(
                MongoEmbeddedHeroPanelHero(oid=h, good=False, opened=False)
            )

        random.shuffle(embedded_hero_objs)

        for index, i in enumerate(embedded_hero_objs):
            panel.panel[str(index+1)] = i

        panel.save()
        return panel