Exemple #1
0
def upgrade(request):
    try:
        admin = request.session['userID']

        try:
            os.remove('upgrade.py')
        except:
            pass

        command = 'wget http://cyberpanel.net/upgrade.py'

        cmd = shlex.split(command)

        res = subprocess.call(cmd)

        vers = version.objects.get(pk=1)

        from upgrade import Upgrade

        Upgrade.initiateUpgrade(vers.currentVersion,vers.build)

        adminData = {"upgrade":1}

        json_data = json.dumps(adminData)

        return HttpResponse(json_data)


    except KeyError:
        adminData = {"upgrade": 1,"error_message":"Please login or refresh this page."}
        json_data = json.dumps(adminData)
        return HttpResponse(json_data)
Exemple #2
0
    def __init__(self):
        # Contains all upgrades
        self.upgrades = [

            # All Talent Upgrades
            Upgrade('Composure', 1, 'Talent'),
            Upgrade('Deadeye Shot', 1, 'Talent'),
            Upgrade('Heroic', 1, 'Talent', ['Resistance']),
            Upgrade('Marg Sabl Closure', 1, 'Talent')
        ]
        
        self.ships = [
            ### REBEL SHIPS ###
            Ship(Pilot('Norra Wexley', 55, ['Talent', 'Crew', 'Astromech', 'Torpedo', 'Gunner', 'Modification'], 'While you defend, if there is an enemy ship at range 0-1, add 1 evade result to your dice results.')
                                                ,'ARC-170 Starfighter', ['Rebel'], '', [5, '^3', 'v2', 1, 6, 3, '0', '0'], ['Focus', 'Target Lock', 'Red Boost', 'Red Rotate']),

            ### RESISTANCE SHIPS ###
            # Scavenged YT-1300 Pilots
            Ship(Pilot('Rey', 68, ['Force', 'Crew', 'Gunner', 'Modification', 'Missle', 'Crew', 'Ilicit', 'Title'], 'While you defend or perform an attack, if the enemy ship is in your forward arc, you my spend 1 force to change 1 of your blank results to an evade or hit result.')
                                                ,'Scavenged YT-1300', ['Resistance'], '', [5, '^3', 1, 8, 3, '0', '^2'], ['Focus', 'Target Lock', 'Red Boost', 'Red Rotate']),
            # T-70 X-Wing Pilots
            Ship(Pilot('Poe Dameron [HoH]', 60, ['Talent', 'Tech', 'Configuration', 'Hardpoint', 'Astromech', 'Modification', 'Title'], 'After a friendly ship at range 0-2 performs an action during its activation, you may spend 2 charge. If you do, that ship may perform a white action, treating it as red.')
                                                ,'T-70 X-Wing', ['Resistance'], 'Weapon Hardpoint: You can equip 1 cannon, torpedo, or missle upgrade', [6, '^3', 2, 4, 3, '^2', '0'], ['Focus', 'Target Lock', 'Boost']),
            Ship(Pilot('Poe Dameron', 62, ['Talent', 'Tech', 'Configuration', 'Hardpoint', 'Astromech', 'Modification', 'Title'], 'After you perform an action, you may spend 1 charge to perform a white action, treating it as red')
                                                ,'T-70 X-Wing', ['Resistance'], 'Weapon Hardpoint: You can equip 1 cannon, torpedo, or missle upgrade', [6, '^3', 2, 4, 3, '^1', '0'], ['Focus', 'Target Lock', 'Boost']),
            Ship(Pilot('Nien Nunb', 55, ['Talent', 'Tech', 'Configuration', 'Hardpoint', 'Astromech', 'Modification', 'Title'], 'After you gain a stress token, if there is an enemy ship in your forward arc at range 0-1, you may remove that stress token.')
                                                ,'T-70 X-Wing', ['Resistance'], 'Weapon Hardpoint: You can equip 1 cannon, torpedo, or missle upgrade', [6, '^3', 2, 4, 3, '0', '0'], ['Focus', 'Target Lock', 'Boost'])
        ]
    def __init__(self):

        # get the display surface
        self.display_surface = pygame.display.get_surface()
        self.game_paused = False
        self.open_game_over = False
        self.open_game_wins = False
        self.inimigos = []

        # sprite group setup
        self.visible_sprites = YSortCameraGroup()
        self.obstacle_sprites = pygame.sprite.Group()

        # attack sprites
        self.current_attack = None
        self.attack_sprites = pygame.sprite.Group()
        self.attackable_sprites = pygame.sprite.Group()

        # sprite setup
        self.create_map()

        # user interface
        self.ui = UI()
        self.upgrade = Upgrade(self.player)

        # particles
        self.animation_player = AnimationPlayer()
        self.magic_player = MagicPlayer(self.animation_player)
Exemple #4
0
def upgrade(request):
    try:
        admin = request.session['userID']

        try:
            os.remove('upgrade.py')
        except:
            pass

        command = 'wget http://cyberpanel.net/upgrade.py'

        cmd = shlex.split(command)

        res = subprocess.call(cmd)

        vers = version.objects.get(pk=1)

        from upgrade import Upgrade

        Upgrade.initiateUpgrade(vers.currentVersion, vers.build)

        adminData = {"upgrade": 1}

        json_data = json.dumps(adminData)

        return HttpResponse(json_data)

    except KeyError:
        adminData = {
            "upgrade": 1,
            "error_message": "Please login or refresh this page."
        }
        json_data = json.dumps(adminData)
        return HttpResponse(json_data)
class UploadTest(unittest.TestCase):
    """
    测试客户积分累积功能,等级升级功能
    """
    def setUp(self):
        self.upload = Upgrade()

    def tearDown(self):
        print "测试结束"

    def test_upload(self):
        print self.upload.upgrade('6236609999', 1000)
Exemple #6
0
def GetHosts(request):
    if request.method == 'POST':
        username = request.user.username
        try:
            role = request.user.userprofile.role
        except:
            role = 'none'
        clientip = request.META['REMOTE_ADDR']
        data = json.loads(request.body)
        logger.info('[POST]%s is requesting. %s : project %s' %
                    (clientip, request.get_full_path(), data['project'][0]))
        exe = Upgrade(data, username, clientip)
        if exe:
            return HttpResponse(json.dumps(exe.getHosts()))
        else:
            return HttpResponseServerError('传入参数不是字典,请检查!')
    else:
        return HttpResponseForbidden('nothing!')
def main():
    manager = get_manager()

    backend_classes = {
        "ldap": LDAPBackend,
        "couchbase": CouchbaseBackend,
        "hybrid": HybridBackend,
        "sql": SQLBackend,
        "spanner": SpannerBackend,
    }

    # initialize the backend
    persistence_type = os.environ.get("CN_PERSISTENCE_TYPE", "ldap")
    backend_cls = backend_classes.get(persistence_type)
    if not backend_cls:
        raise ValueError("Unsupported persistence backend")

    backend = backend_cls(manager)
    backend.initialize()

    # run upgrade if needed
    upgrade = Upgrade(manager)
    upgrade.invoke()
Exemple #8
0
def OpUpgradeDeploy(request):
    if request.is_websocket():
        username = request.user.username
        try:
            role = request.user.userprofile.role
        except:
            role = 'none'
        clientip = request.META['REMOTE_ADDR']
        for postdata in request.websocket:
            if postdata:
                data = json.loads(postdata)

            logger.info('%s is requesting. %s 执行参数:%s' %
                        (clientip, request.get_full_path(), data))
            #request.websocket.send(json.dumps(data))

            exe = Upgrade(data, username, clientip)
            if exe:
                request.websocket.send(json.dumps(exe.Execute()))
            else:
                data['op_status'] = -1
                data['result'] = 'none'
                request.websocket.send(json.dumps(data))
            continue
Exemple #9
0
def import_data(data_dir):
    """Loads all csv files of cards"""
    creature_cards = {}
    with open(os.path.join(data_dir, "creatures.csv"), "r") as in_file:
        csv_reader = csv.DictReader(in_file, quoting=csv.QUOTE_NONNUMERIC)
        unnamed_count = 0
        for row in csv_reader:
            # Creature(name, creature_type, energy, health, attack)
            name = row["name"]
            if name is None or name == "":
                name = "Creature{}".format(unnamed_count)
                unnamed_count += 1
            creature_cards[name] = Creature(name, row["type"], row["energy"],
                                            row["health"], row["attack"])

    armor_cards = {}
    with open(os.path.join(data_dir, "armors.csv"), "r") as in_file:
        csv_reader = csv.DictReader(in_file, quoting=csv.QUOTE_NONNUMERIC)
        for row in csv_reader:
            # Armor(name, attack, damage_negation_per_combat, max_damage_negation)
            if row["name"] is None or row["name"] == "":
                continue
            armor_cards[row["name"]] = Armor(row["name"], row["attack"],
                                             row["damage_negation_per_combat"],
                                             row["max_damage_negation"])

    weapon_cards = {}
    with open(os.path.join(data_dir, "weapons.csv"), "r") as in_file:
        csv_reader = csv.DictReader(in_file, quoting=csv.QUOTE_NONNUMERIC)
        for row in csv_reader:
            # Weapon(name, attack, max_uses)
            if row["name"] is None or row["name"] == "":
                continue
            weapon_cards[row["name"]] = Weapon(row["name"], row["attack"],
                                               row["max_uses"])

    upgrade_cards = {}
    with open(os.path.join(data_dir, "upgrades.csv"), "r") as in_file:
        csv_reader = csv.DictReader(in_file, quoting=csv.QUOTE_NONNUMERIC)
        for row in csv_reader:
            # Upgrade(name, upgrades)
            if row["name"] is None or row["name"] == "":
                continue
            upgrade_cards[row["name"]] = Upgrade(row["name"],
                                                 literal_eval(row["upgrades"]))

    return creature_cards, armor_cards, weapon_cards, upgrade_cards
Exemple #10
0
def get_upgrade_objects(phox, upgradeDB):
    for index1, row in enumerate(phox.upgrade_tree_strings):
        phox.upgrade_tree.append([])
        for index2, upgrade in enumerate(row):
            upgrade_object = Upgrade()
            db_info = upgradeDB.find({"name": upgrade})
            for doc in db_info:
                upgrade_object.name = doc["name"]
                upgrade_object.plain_text_effect = doc["plain text effect"]
            upgrade = upgrade_object
            phox.upgrade_tree[index1].append(upgrade_object)
    for string in phox.upgrades:
        upgrade_object = Upgrade()
        db_info = upgradeDB.find({"name": string})
        for doc in db_info:
            upgrade_object.name = doc["name"]
            upgrade_object.plain_text_effect = doc["plain text effect"]
        phox.base_upgrades.append(upgrade_object)
Exemple #11
0
    def __init__(self, tela, design, idioma, interface_idioma, icon):
        self.icon = icon
        self.interface_idioma = interface_idioma
        self.tp_atualizacao = None
        self.idioma = idioma
        self.design = design
        self.tela = tela

        # Destino dos Downloads e Backups
        data = str(datetime.now()).split('.')[0]
        data = data.replace(' ', '-')
        data = data.replace(':', '-')

        dest_download = os_path.join(os_getcwd(), 'AtualizarSafira')
        dest_backup = os_path.join(os_getcwd(), 'backups', data)

        # Instância de Upgrades
        self.up = Upgrade.Upgrade(dest_download, dest_backup)
Exemple #12
0
    def write_txt(self):
        p = Pay()
        total_product_list = p.total_amount()
        discount_product_list = p.pay_amount()
        c_info = Upgrade().upgrade(total_product_list['memberId'],
                                   discount_product_list['discount'])
        # c_info = p.customer_info(total_product_list['memberId'])
        # print c_info
        order_id = json.dumps(total_product_list['order_id'])
        create_time = json.dumps(total_product_list['create_time'])
        member_id = json.dumps(total_product_list['memberId'])
        points = json.dumps(c_info['points'])

        with open("../files/result.txt", 'w') as wf:
            new_context = "方鼎银行贵金属购买凭证\r\n\r\n销售单号:" + order_id + " 日期:" + create_time + "\r\n" + \
                          "客户卡号:" + member_id + " 会员姓名:" + c_info['name'] + " 客户等级:" + c_info[
                              'level'] + " 累计积分:" + points
            new_context += "\r\n\r\n商品及数量           单价         金额\r\n"
            for total_product in total_product_list['product_detail']:
                id = json.dumps(total_product['id'])
                amount = json.dumps(total_product['amount'])
                price = json.dumps(total_product['price'])
                total_amount = json.dumps(total_product['total_amount'])
                new_context += "(" + id + ")" + total_product['name'] + "*" + amount + "," + price + "," + \
                               total_amount + "\r\n"

            new_context += "合计:" + json.dumps(
                total_product_list['total']) + "\r\n\r\n优惠清单:\r\n"
            for discount_product in discount_product_list[
                    'discount_product_detail']:

                # id = json.dumps(discount_product['id'])
                total_amount = json.dumps(discount_product['total_amount'])
                new_context += "(" + discount_product['id'] + ")" + discount_product['name'] + ":-" + total_amount + \
                               total_amount + "\r\n"

            wf.write(new_context)
Exemple #13
0
    def move(self):
        # Checks if Mario has collided with the flag pole and has him slowly move down the pole
        if pygame.sprite.spritecollide(self, self.poles, False):
            self.stats.reached_pole = True
            self.frame_counter = 0
            if self.rect.y != 508:
                self.rect.y += 1
            self.rect.x += self.x_change
        else:
            self.calc_gravity()

            if self.rect.left > 20:
                self.rect.x += self.x_change
            else:
                self.rect.x = 22
            # Checks if Mario is in the main level
            if not self.stats.secret_level:
                # Checks if Mario collides with a pipe from the sides and prevents him from moving into it
                pipe_collide = pygame.sprite.spritecollide(
                    self, self.pipes, False)
                for pipe in pipe_collide:
                    if self.x_change > 0:
                        self.rect.right = pipe.rect.left
                    if self.x_change < 0:
                        self.rect.left = pipe.rect.right

                self.rect.y += self.y_change

                # Checks if Mario collides with a pipe from the top and allows him to stand on it
                pipe_collide = pygame.sprite.spritecollide(
                    self, self.pipes, False)
                for pipe in pipe_collide:
                    if self.y_change > 0:
                        self.rect.bottom = pipe.rect.top
                        if pipe.num == 3 and self.crouch:
                            self.stats.activate_secret = True
                            self.stats.secret_level = True
                    elif self.y_change < 0:
                        self.rect.top = pipe.rect.bottom
                    self.y_change = 0

                # Checks if Mario collides with side of bricks
                brick_collide = pygame.sprite.spritecollide(
                    self, self.bricks, False)
                for brick in brick_collide:
                    if self.rect.right >= brick.rect.left and brick.rect.bottom == self.rect.bottom:
                        self.x_change = 0
                    if self.rect.left <= brick.rect.right and brick.rect.bottom == self.rect.bottom:
                        self.x_change = 0

                # Checks collision with the bricks from the top and
                # bottom so that he can stand on them and not go through them
                brick_collide = pygame.sprite.spritecollide(
                    self, self.bricks, False)
                for brick in brick_collide:
                    if self.y_change > 0:
                        self.rect.bottom = brick.rect.top
                    elif self.y_change < 0:
                        self.rect.top = brick.rect.bottom
                    self.y_change = 0

                    # Checks if the brick with the star is hit,
                    # if it is then spawns a moving star, and change block to empty
                    if brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 5 and not brick.change_brick:
                        brick.change_brick = True
                        upgrade = Upgrade(self.screen, self.settings,
                                          self.pipes, self.bricks,
                                          brick.rect.x, brick.rect.y - 20, 3)
                        self.upgrades.add(upgrade)
                        brick.change()

                    if brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 6 and not brick.change_brick:
                        brick.change_brick = True
                        upgrade = Upgrade(self.screen, self.settings,
                                          self.pipes, self.bricks,
                                          brick.rect.x, brick.rect.y - 20, 2)
                        self.upgrades.add(upgrade)
                        brick.change()

                    # Checks if ? block is hit and if it is check what kind it is
                    if brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 2:
                        brick.change()
                        # Checks if it is a ? block with a mushroom in it
                        # and spawns one when hit and change block to empty
                        if brick.block_type == 2 and not brick.change_brick and brick.rect.y < self.rect.y \
                                and not self.shroomed:
                            brick.change_brick = True
                            upgrade = Upgrade(self.screen, self.settings,
                                              self.pipes, self.bricks,
                                              brick.rect.x, brick.rect.y - 20,
                                              0)
                            self.upgrades.add(upgrade)
                        # Checks if Mario is big and if he is then mushroom block
                        # spawns a fire flower and change block to empty
                        if brick.block_type == 2 and not brick.change_brick and brick.rect.y < self.rect.y \
                                and self.shroomed:
                            brick.change_brick = True
                            upgrade = Upgrade(self.screen, self.settings,
                                              self.pipes, self.bricks,
                                              brick.rect.x, brick.rect.y - 40,
                                              1)
                            self.upgrades.add(upgrade)
                    # Checks if ? block is regular one and spawns draws a coin for
                    # a bit when hit and change block to empty
                    if brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 1:
                        brick.change()
                        self.stats.coins += 1

                    if brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 9 and not brick.change_brick:
                        if self.count != 4:
                            self.stats.coins += 1
                            self.count += 1
                        else:
                            brick.change_brick = True
                            brick.change()

                    # Check if Mario is big and below the block and if he is and hits it the brick is removed
                    if brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 0 and self.shroomed:
                        self.bricks.remove(brick)
                        self.clips[2].play()
                    elif brick.rect.x - 20 < self.rect.x < brick.rect.x + 20 and brick.rect.y < self.rect.y \
                            and brick.block_type == 0 and not self.shroomed:
                        brick.bouncing = True
                        self.clips[1].play()

            if self.stats.secret_level:
                # If Mario collides with the side prevents him from going through
                pipe_collide = pygame.sprite.spritecollide(
                    self, self.secret_pipes, False)
                for pipe in pipe_collide:
                    if self.x_change > 0:
                        self.rect.right = pipe.rect.left
                        # If Mario collides with a certain part of the pipe the secret level is cleared and
                        # Mario returns to the main level
                        if pipe.num == 7:
                            self.secret_pipes.empty()
                            self.upgrades.empty()
                            self.secret_bricks.empty()
                            self.stats.activate_main_lvl = True
                            self.stats.main_level = True
                            self.stats.return_main_level = True
                            self.stats.secret_level = False
                    if self.x_change < 0:
                        self.rect.left = pipe.rect.right

                self.rect.y += self.y_change

                # Checks if Mario collides with a pipe from the top and allows him to stand on it
                pipe_collide = pygame.sprite.spritecollide(
                    self, self.secret_pipes, False)
                for pipe in pipe_collide:
                    if self.y_change > 0:
                        self.rect.bottom = pipe.rect.top
                    elif self.y_change < 0:
                        self.rect.top = pipe.rect.bottom
                    self.y_change = 0

                brick_collide = pygame.sprite.spritecollide(
                    self, self.secret_bricks, False)
                for brick in brick_collide:
                    if self.rect.right >= brick.rect.left and brick.rect.bottom == self.rect.bottom:
                        self.x_change = 0
                    if self.rect.left <= brick.rect.right and brick.rect.bottom == self.rect.bottom:
                        self.x_change = 0

                # Checks collision with the bricks from the top and
                # bottom so that he can stand on them and not go through them
                brick_collide = pygame.sprite.spritecollide(
                    self, self.secret_bricks, False)
                for brick in brick_collide:
                    if self.y_change > 0:
                        self.rect.bottom = brick.rect.top
                    elif self.y_change < 0:
                        self.rect.top = brick.rect.bottom
                    self.y_change = 0
Exemple #14
0
 def __init__(self, packagenames, configdict=None):
     Upgrade.__init__(self,configdict)
     self.pkgdrv.opendb_readwrite()
     self.eraseobj = EraseObject(self.pkgdrv, self.log,packagenames)
Exemple #15
0
 def create_coin(self, x, y, num):
     self.coin = Upgrade(self.screen, self.settings, self.pipes,
                         self.bricks, x, y, num)
     self.upgrades.add(self.coin)
 def setUp(self):
     self.upload = Upgrade()
Exemple #17
0
class Level:
    def __init__(self):

        # get the display surface
        self.display_surface = pygame.display.get_surface()
        self.game_paused = False
        self.open_game_over = False
        self.open_game_wins = False
        self.inimigos = []

        # sprite group setup
        self.visible_sprites = YSortCameraGroup()
        self.obstacle_sprites = pygame.sprite.Group()

        # attack sprites
        self.current_attack = None
        self.attack_sprites = pygame.sprite.Group()
        self.attackable_sprites = pygame.sprite.Group()

        # sprite setup
        self.create_map()

        # user interface
        self.ui = UI()
        self.upgrade = Upgrade(self.player)

        # particles
        self.animation_player = AnimationPlayer()
        self.magic_player = MagicPlayer(self.animation_player)

    def setOpenGameWins(self):
        self.open_game_wins = True

    def create_map(self):
        layouts = {
            'boundary': import_csv_layout('../map/mapateste_barreira.csv'),
            'entities': import_csv_layout('../map/mapateste_inimigos.csv')
        }

        for style, layout in layouts.items():
            for row_index, row in enumerate(layout):
                for col_index, col in enumerate(row):
                    if col != '-1':
                        x = col_index * TILESIZE
                        y = row_index * TILESIZE
                        if style == 'boundary':
                            Tile((x, y), [self.obstacle_sprites], 'invisible')

                        if style == 'entities':
                            if col == '394':
                                self.player = Player(
                                    (x, y), [self.visible_sprites],
                                    self.obstacle_sprites, self.create_attack,
                                    self.destroy_attack, self.create_magic)
                            else:
                                if col == '390':
                                    monster_name = 'duende'
                                elif col == '389':
                                    monster_name = 'boss'
                                else:
                                    monster_name = 'esqueleto'
                                self.inimigo = Enemy(
                                    monster_name, (x, y), [
                                        self.visible_sprites,
                                        self.attackable_sprites
                                    ], self.obstacle_sprites,
                                    self.damage_player,
                                    self.trigger_death_particles, self.add_exp,
                                    self.setOpenGameWins)
                                self.inimigos.append(self.inimigo)

    def kill_all_enemies(self):
        for inimigo in self.inimigos:
            inimigo.kill()

    def create_attack(self):
        self.current_attack = Weapon(
            self.player, [self.visible_sprites, self.attack_sprites])

    def create_magic(self, style, strength, cost):
        if style == 'heal':
            self.magic_player.heal(self.player, strength, cost,
                                   [self.visible_sprites])

        if style == 'flame':
            self.magic_player.flame(
                self.player, cost, [self.visible_sprites, self.attack_sprites])

    def destroy_attack(self):
        if self.current_attack:
            self.current_attack.kill()
        self.current_attack = None

    def player_attack_logic(self):
        if self.attack_sprites:
            for attack_sprite in self.attack_sprites:
                collision_sprites = pygame.sprite.spritecollide(
                    attack_sprite, self.attackable_sprites, False)
                if collision_sprites:
                    for target_sprite in collision_sprites:
                        if target_sprite.sprite_type == 'grass':
                            pos = target_sprite.rect.center
                            offset = pygame.math.Vector2(0, 75)
                            for leaf in range(randint(3, 6)):
                                self.animation_player.create_grass_particles(
                                    pos - offset, [self.visible_sprites])
                            target_sprite.kill()
                        else:
                            target_sprite.get_damage(self.player,
                                                     attack_sprite.sprite_type)

    def damage_player(self, amount, attack_type):
        if self.player.vulnerable:
            self.player.health -= amount
            self.player.vulnerable = False
            self.player.hurt_time = pygame.time.get_ticks()
            if self.player.health <= 0:
                self.open_game_over = True
                self.kill_all_enemies()

            #self.animation_player.create_particles(attack_type,self.player.rect.center,[self.visible_sprites])

    def trigger_death_particles(self, pos, particle_type):
        pass

    #    self.animation_player.create_particles(particle_type,pos,self.visible_sprites)

    def add_exp(self, amount):
        self.player.exp += amount

    def toggle_menu(self):
        self.game_paused = not self.game_paused

    def run(self):
        self.visible_sprites.custom_draw(self.player)
        self.ui.display(self.player)

        if self.game_paused:
            self.upgrade.display()
        else:
            self.visible_sprites.update()
            self.visible_sprites.enemy_update(self.player)
            self.player_attack_logic()

        if self.open_game_over:
            return 2
        elif self.open_game_wins:
            return 1
        else:
            return 0