def default_values(): db.create_database() clas = [ c.clas('Guerreiro', 7, 4, 0, 1), c.clas('Arqueiro', 4, 3, 0, 7), c.clas('Feiticeiro', 4, 2, 7, 2) ] for cl in clas: db.create_class(cl) race = [c.race('Human', 5, 5, 5, 5)] for ra in race: db.create_race(ra) player = [c.player('Rubens', 1, 0, 1, 1)] for pl in player: db.create_player(pl) iten = [ c.item('Machado de Assis', 'Um machado feito pelos deuses da literatura brasileira', 3, 3, 0, 0), c.item('Espada de São Darwin', 'Espada feita do primeiro minério descoberto', 3, 3, 0, 0), c.item('Cajado de Flamel', 'Cajado abençoado por Aristóteles', 1, 2, 4, 0), c.item( 'Arco de Sagitário', 'Signo não influenciam, mas um disparo no peito muda o destino de alguém.', 1, 2, 0, 3), c.item( 'Crucifixo da Madeira da Cruz de Cristo', 'Adquirido em uma liquidação papal de indulgências, Lutero condena isso.', 0, 2, 4, 0) ] for it in iten: db.create_item(it)
def add(bot, update, args): query = update.callback_query logger.info('Query data: %s', args[0]) if "https://www.amazon.es/" in args[0]: chat_id = update.message.chat_id newItem = classes.item(chat_id, args[0]) addToDB(newItem) logging.info("{} {}".format( amazon.getName(args[0]).strip(), amazon.checkPrice(args[0]))) bot.send_message(chat_id, text="Product '{}' added! Actual price is {}€".format( amazon.getName(args[0]).strip(), amazon.checkPrice(args[0]))) else: logger.info('Nope') return
def reset(): global counter global score_val global pear global apple global hedgehog global hedgehog_speed global hedgehog_mul global stone global dead global hedgehogRight global hedgehogLeft global appleImg global pearImg stone = item([random.randint(0, MAX_X)], [-400], pygame.image.load(stoneImg), [2.88], mixer.Sound('sounds/StoneHit.wav')) apple.X = [ random.randint(0, MAX_X), random.randint(0, MAX_X), random.randint(0, MAX_X) ] counter = 0 score_val = 0 pear.Y = -20 for i in range(3): apple.Y[i] = (i + 1) * -100 hedgehog.X = (SCREEN_WIDTH - IMG_SIZE) / 2 hedgehog_speed = 3.6 hedgehog_mul = 1.0 hedgehog.change = 0 hedgehogRight = "images/hedgehog.png" hedgehogLeft = "images/hedgehog_rev.png" appleImg = "images/apple.png" pearImg = "images/pear.png" hedgehog.Img = pygame.image.load(hedgehogRight) apple.Img = pygame.image.load(appleImg) pear.Img = pygame.image.load(pearImg)
def get_item(value = '', param = 'id'): conn = get_connection() cur = conn.cursor() cur.execute(f'SELECT * FROM item WHERE {param} = "{value}";') rows = cur.fetchall() if rows: item = c.item( rows[0][1], rows[0][2], rows[0][3], rows[0][4], rows[0][5], rows[0][6], rows[0][0] ) return item return False
#! /usr/bin/python3.8 import actions import classes #items potion = classes.item(name='potion', value=10, health_up=5) super_potion = classes.item(name='super_potion', value=20, health_up=10) #Inventories character_inventory = {'potion': 1} inventory_user = classes.inventory('character_inventory', ["potion"]) inventory_basic = classes.inventory("inventory_basic", ['potion']) inventory_advanced = classes.inventory("inventory_advanced", ['potion', 'super_potion']) inventory_lots = classes.inventory("inventory_lots", [ 'potion', 'potion', 'potion', 'potion', 'super_potion', 'super_potion', 'super_potion', 'super_potion' ]) inventory_gold = classes.inventory("inventory_gold", [50]) #Characters user = classes.character('bob', 10, 2, 1, character_inventory, 50) mouse = classes.character('mouse', 2, 1, 1, inventory_gold) rat = classes.character('rat', 10, 2, 1, inventory_basic) ROUS = classes.character('ROUS', 15, 4, 1, inventory_advanced) #Stores home_store = classes.store('home store', inventory_lots, 50) choice = ""
move3=mv0000) npc0010 = classes.npc(name='Starving Spider', level=1, desc='An Arachnid starving and in desperation for food', essential='no', hostile='yes', HP=10, AP=15, move1=mv0010, move2=mv0012, move3=mv0000) # none========================================================================= none = classes.item(ID='none', name='none', weight=0, value=0, desc='empty slot') #=============================================================================== # NOTE: if you wanna add quest items and such they'll go here
pygame.display.set_caption("Mr. Hedgehog's Adventures") #zmiana ikony okna gry icon = pygame.image.load('images/hedgehog32.png') pygame.display.set_icon(icon) #ikonki jako stringi hedgehogRight = "images/hedgehog.png" hedgehogLeft = "images/hedgehog_rev.png" appleImg = "images/apple.png" pearImg = "images/pear.png" stoneImg = "images/stone.png" #gracz (jeż) hedgehog = item((SCREEN_WIDTH - IMG_SIZE) / 2, SCREEN_HEIGHT - 120 - (IMG_SIZE / 2), pygame.image.load(hedgehogRight), 0, mixer.Sound('sounds/StoneHit.wav')) hedgehog_speed = 3.6 hedgehog_mul = 1.0 # jablko apple = item([ random.randint(0, MAX_X), random.randint(0, MAX_X), random.randint(0, MAX_X) ], [-110, -210, -310], pygame.image.load(appleImg), [3.02, 2.74, 2.88], mixer.Sound('sounds/AppleBite.wav')) # gruszka pear = item(random.randint(0, MAX_X), -10, pygame.image.load(pearImg), 3.31,