Ejemplo n.º 1
0
def cont(screen=None):
    while True:
        scr = title(None,None,None,False)
        if scr == 'game':
            main(ww,hh,win)
        elif scr == 'shop':
            shop.shop(win,1)
Ejemplo n.º 2
0
async def answer(callback_query: types.CallbackQuery):

    if callback_query.data == "shop_food":

        await callback_query.message.edit_text(f'🍌 <b>Еда</b>',
                                               reply_markup=shop.shop(
                                                   callback_query.data))

    if callback_query.data == "shop_tools":
        await callback_query.message.edit_text(f'🧸 <b>Штуки</b>',
                                               reply_markup=shop.shop(
                                                   callback_query.data))

    if callback_query.data == "shop_assets":
        await callback_query.message.edit_text(f'🏡 <b>Активы</b>',
                                               reply_markup=shop.shop(
                                                   callback_query.data))

    if callback_query.data == "shop_emoji":
        await callback_query.message.edit_text(
            f'Чтоб купить эмодзи, пропиши в чате\n<code>buyemoji 💩</code>\n<i>(вместо говна, само собой ваш эмодзи)\n</i>Цена: <b>1к</b> 💕',
            reply_markup=shop.shop(callback_query.data))

    if callback_query.data == "shop_back":
        await callback_query.message.edit_text(
            f"🎁 <b>Добро пожаловать 🎁\n               в холишоп</b>",
            reply_markup=shop.shop("shop_main"))

    await bot.answer_callback_query(callback_query.id)
Ejemplo n.º 3
0
def the_wastes(player):
    the_map = mapify('the_wastes_map.txt')
    print_map(the_map)
    x = 15
    y = 15
    while True:
        o_x = x
        o_y = y
        print("\033[H", end="")
        print_map(the_map)
        the_map[y][x] = ' '
        key_pressed = getch()
        if key_pressed == 'w':
            y -= 1
        elif key_pressed == 's':
            y += 1
        elif key_pressed == 'd':
            x += 1
        elif key_pressed == 'a':
            x -= 1
        elif key_pressed == 'l':
            break
        if the_map[y][x] not in ('S', 'L', 'P', '|', '_', 'K', 'A', 'M'):
            the_map[y][x] = 'player'
        elif the_map[y][x] == 'S':
            shop.shop(player)
        elif the_map[y][x] == 'P':
            ai_talk.speak_dude(player)
        elif the_map[y][x] == 'L':
            secret_lib_thing.library()
        elif the_map[y][x] == 'M':
            battle.battle(player)
        else:
            x = o_x
            y = o_y
Ejemplo n.º 4
0
    def main_map(self, screen, player, assets):
        escape_call = Escape()
        sector_map = IconTree(self.images)
        sector_map.update()
        player_loc = sector_map.root
        alive = True
        win = None
        while alive and win is None:
            screen.blit(self.bg, (0, 0))
            screen.blit(self.legend, (580, 20))
            screen.blit(self.up, self.up_rect)
            screen.blit(self.down, self.down_rect)

            for event in pygame.event.get():
                if event.type == QUIT:
                    pygame.quit()
                    sys.exit()
                    break

                elif event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        escape_call.escape_menu(screen)
                        break
                elif event.type == MOUSEBUTTONDOWN:
                    position = pygame.mouse.get_pos()
                    if self.up_rect.collidepoint(
                            position) or self.down_rect.collidepoint(position):
                        sector_map.scroll(screen, player_loc, self.bg,
                                          self.legend, self.up, self.down,
                                          self.up_rect, self.down_rect)
                    for sp in sector_map.sprites():
                        if sp.is_child(player_loc) and sp.collide(position):
                            player_loc = sp
                            if sp.type == 'minion':
                                alive = battle(screen, player, assets,
                                               escape_call)
                            elif sp.type == 'boss':
                                win = battle(screen,
                                             player,
                                             assets,
                                             escape_call,
                                             boss=True)
                            elif sp.type == 'unknown':
                                alive = events(screen, player, assets,
                                               escape_call)
                            elif sp.type == 'repair':
                                repair(screen, player, assets, escape_call)
                            elif sp.type == 'shop':
                                shop(screen, player, assets, escape_call)
                if alive:
                    sector_map.draw(screen, player_loc)
                    pygame.display.update()
            if player.current_health <= 0:
                break
        if not win or player.current_health <= 0:
            game_over(screen)
        if (win):
            game_win(screen)
Ejemplo n.º 5
0
def mainAct(pl):
    clear()
    choice = pMenu([
        'hunt',
        'move',
        'heal',
        'party',
        'shop',
        'dex',
        'bank',
        pl.name,
        'save',
        'leave',
    ])
    if choice == 'hunt':
        if not pl.countawake():
            clear()
            print pl.name + ' is out of usable pokemon!'
            xxx = raw_input('\n\npress enter')
        else:
            hunt(pl)
    if choice == 'party':
        party(pl)
    if choice == pl.name:
        clear()
        print 'Status\n\n'
        print pl.name + '   $' + str(pl.money)
        for bt in pl.balls:
            if pl.balls[bt] > 0:
                print bt + ': ' + str(pl.balls[bt])
        print '\n'
        raw_input('enter to return')
        return 0
    if choice == 'shop':
        shop(pl)
    if choice == 'heal':
        heal(pl)
    if choice == 'dex':
        dexui(pl)
    if choice == 'bank':
        bank(pl)
    if choice == 'save':
        save(pl)
    if choice == 'leave':
        return 1
    if choice == 'move':
        move(pl)
Ejemplo n.º 6
0
def main():
    print_header()
    # player = start_choice()
    player = start()
    if not player:
        player = start_choice()
    info(player)
    sleep(2)
    active = True

    while active:
        option = menu()
        # Quest Option
        if option == "quest":
            if player.quest:  # check that a quest exists
                confirm = input("Start quest?: {} (y/n) \n>>>".format(
                    player.quest))
                if confirm.find("y") != -1:
                    # TODO: make a good system for this, cuz 2 lines of extra elifs per quest cant be great
                    print(
                        "[!]Warning: This version of Quest is in beta. Proceed with caution."
                    )
                    if player.quest == "Clap the Dragon":
                        quests.clap_the_dragon(player)
                    elif player.quest == "Dab on Turtles":
                        quests.battle_turtles(player, 5)
                else:
                    print("ok then")
            else:
                print("ok maybe next time")
        # Inventory Option
        elif option == "inventory":
            print("----{INVENTORY}----")
            if not player.inventory:  # if nothing exists in the inventory
                print("[*] Nothing!")
            else:
                for item in player.inventory:
                    print("[*] {} ({})".format(item, player.inventory[item]))
        # Shop Option
        elif option == "shop":
            shop.shop(player)
        # Exit Option
        elif option == "exit":
            print("See ya later!")
            data.save(player)
            active = False
Ejemplo n.º 7
0
def beggar_city(player):
    the_map = mapify('beggar_city.txt')
    print_map(the_map)
    x = 15
    y = 15
    while True:
        o_x = x
        o_y = y
        print("\033[H", end="")
        print_map(the_map)
        the_map[y][x] = ' '
        key_pressed = getch()
        if key_pressed == 'w':
            y -= 1
        elif key_pressed == 's':
            y += 1
        elif key_pressed == 'd':
            x += 1
        elif key_pressed == 'a':
            x -= 1
        elif key_pressed == 'l':
            break
        if the_map[y][x] not in ('S', 'L', 'P', '|', '_', 'K', 'A', 'M', 'B',
                                 'G', 'Z', 'Q', 'D', 'x'):
            the_map[y][x] = 'player'
        elif the_map[y][x] == 'S':
            shop.shop(player)
        elif the_map[y][x] == 'P':
            ai_talk.speak_dude(player)
        elif the_map[y][x] == 'L':
            secret_lib_thing.library()
        elif the_map[y][x] == 'M':
            battle.battle(player)
        elif the_map[y][x] == 'D':
            multi_battle.duck_fight(player)
        elif the_map[y][x] == 'B':
            ai_talk.mega_rat(player)
        elif the_map[y][x] == 'Z':
            ai_talk.farlands(player)
        elif the_map[y][x] == 'x':
            boss_fight.gate_keeper(player)

        else:
            x = o_x
            y = o_y
Ejemplo n.º 8
0
def get_input(board, level):
    move = util.key_pressed()
    row = playerindex_row(board)
    col = playerindex_col(board)
    if move == "d":
        if board[row][col + 1] == "O":
            return 1
        elif board[row][col + 1] == "E":
            fight.fight_sys(level)
            board[row][col] = " "
            board[row][col + 1] = "X"
        elif board[row][col + 1] == " ":
            board[row][col] = " "
            board[row][col + 1] = "X"
        elif board[row][col + 1] == "S":
            shop.shop(level)
    elif move == "a":
        if board[row][col - 1] == " ":
            board[row][col] = " "
            board[row][col - 1] = "X"
        elif board[row][col - 1] == "E":
            fight.fight_sys(level)
            board[row][col] = " "
            board[row][col - 1] = "X"
        elif board[row][col - 1] == "S":
            shop.shop(level)
    elif move == "s":
        if board[row + 1][col] == " ":
            board[row][col] = " "
            board[row + 1][col] = "X"
        elif board[row + 1][col] == "E":
            fight.fight_sys(level)
            board[row][col] = " "
            board[row + 1][col] = "X"
        elif board[row + 1][col] == "S":
            shop.shop(level)
    elif move == "w":
        if board[row - 1][col] == " ":
            board[row][col] = " "
            board[row - 1][col] = "X"
        elif board[row - 1][col] == "E":
            fight.fight_sys(level)
            board[row][col] = " "
            board[row - 1][col] = "X"
        elif board[row - 1][col] == "S":
            shop.shop(level)
    elif move == "h":
        help.help()
    elif move == "i":
        inventory_sys.inventory()
    elif move == "q":
        util.clear_screen()
        sys.exit()
    return 0
Ejemplo n.º 9
0
def kreiten_castle(player):
    if player['mission11'] == True:
        util.change_map('krieten_castle_map.txt', 'mission11_hack_map.txt')
    the_map = mapify('kreiten_castle_map.txt')
    print_map(the_map)
    x = 15
    y = 15
    while True:
        o_x = x
        o_y = y
        print("\033[H", end="")
        print_map(the_map)
        the_map[y][x] = ' '
        key_pressed = getch()
        if key_pressed == 'w':
            y -= 1
        elif key_pressed == 's':
            y += 1
        elif key_pressed == 'd':
            x += 1
        elif key_pressed == 'a':
            x -= 1
        elif key_pressed == 'l':
            break
        if the_map[y][x] not in ('S', 'L', 'P', '|', '_', 'K', 'A', 't'):
            the_map[y][x] = 'player'
        elif the_map[y][x] == 'S':
            shop.shop(player)
        elif the_map[y][x] == 'P':
            ai_talk.speak_dude(player)
        elif the_map[y][x] == 'L':
            secret_lib_thing.library()
        elif the_map[y][x] == 't':
            sell.sell(player)
        elif the_map[y][x] == 'K':
            ai_talk.king(player)
        else:
            x = o_x
            y = o_y
Ejemplo n.º 10
0
def menu_select(user,left):
    act_num = raw_input('plz input your select(1 2 3 4 5):').strip()
    while len(act_num) == 0:
	break
    if act_num == '1':
        left = withdaw(user,left)
    elif act_num == '2':
        left = cashin(user,left)
	print type(left)
    elif act_num == '3':
        checkbill(user)
    elif act_num == '4':
        left = shop(user,left)
    elif act_num == '5':
        exit()
    else:
         print 'no this select'
    return left
    print left
Ejemplo n.º 11
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle(u"Магаз")
        self.shop = shop()
        self.dataxml = dataxml()
        self.datasql = datasql()
        self.tabWidget = tabWidget(self.shop, self)
        self.tabWidget.currentChanged.connect(self.tabWidget.tabChangedSlot)
        self.setCentralWidget(self.tabWidget)
        self.tabWidget.update()

        self.new = QAction(QIcon(), "New", self)
        self.new.setStatusTip("New database")
        self.new.triggered.connect(self.newAction)

        self.openxml = QAction(QIcon(), "Open XML", self)
        self.openxml.setStatusTip("Open data from XML")
        self.openxml.triggered.connect(self.openXMLAction)

        self.opensql = QAction(QIcon(), "Open SQL", self)
        self.opensql.setStatusTip("Open data from SQL")
        self.opensql.triggered.connect(self.openSQLAction)

        self.savexml = QAction(QIcon(), "Save XML", self)
        self.savexml.setStatusTip("Save data to XML")
        self.savexml.triggered.connect(self.saveXMLAction)

        self.savesql = QAction(QIcon(), "Save SQL", self)
        self.savesql.setStatusTip("Save data to SQL")
        self.savesql.triggered.connect(self.saveSQLAction)

        self.menubar = self.menuBar()
        self.menufile = self.menubar.addMenu("&File")
        self.menufile.addAction(self.new)
        self.menufile.addSeparator()
        self.menufile.addAction(self.openxml)
        self.menufile.addAction(self.opensql)
        self.menufile.addSeparator()
        self.menufile.addAction(self.savexml)
        self.menufile.addAction(self.savesql)
        self.statusBar()
Ejemplo n.º 12
0
def main():
    status = ''
    while status != "dead":
        try:
            print('What do you want to do?')
            select = selection(["Battle", "Shop", "Inventory"], 0)
            if select[1] == 'Battle':
                print('You go to battle!')
                status = battle(hero)
            elif select[1] == 'Shop':
                print('You go to the shop!')
                wgi = shop(hero.gold, hero.inventory, hero)
                hero.gold = wgi[0]
                hero.inventory = wgi[1]
            elif select[1] == 'Inventory':
                wgi = inventory(hero.equipped_weapon, hero.gold, hero.inventory, hero)
                hero.equipped_weapon = wgi[0]
                hero.gold = wgi[1]
                hero.inventory = wgi[2]
            else:
                print("Invalid input %r" % select[1])
        except:
            print("Invalid input")
Ejemplo n.º 13
0
def town(SAVE_DATA):
    '''Main town menu to visit shop, rest, adventure, or return to main menu'''
    print("You have arrived at the town.")
    command = input(
        "S = Shop\nR = Rest(Save Game)\nA = Adventure\nM = Main Menu\n")
    if command.lower() == "s":
        clear_screen()
        SAVE_DATA = shop(SAVE_DATA)
        town(SAVE_DATA)
    elif command.lower() == "r":
        clear_screen()
        SAVE_DATA = rest(SAVE_DATA)
        town(SAVE_DATA)
    elif command.lower() == "a":
        clear_screen()
        SAVE_DATA = adventure(SAVE_DATA)
        town(SAVE_DATA)
    elif command.lower() == "m":
        clear_screen()
        main_menu(SAVE_DATA)
    else:
        clear_screen()
        town(SAVE_DATA)
Ejemplo n.º 14
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Pw @ 2015-11-03 09:58:36
# author: 郑集文
# Description: deposit
import shop, os
shop = shop.shop()
#判断用户名
while True:
    user_name = raw_input("\nPlease input you name:")
    file_name = user_name + '.txt'
    if os.path.exists(file_name):
        break
    else:
        print "\n未找到此用户名请重新输入."

#主程序
deposit_judge = raw_input("\nDo you need to recharge [y/n]?")
if deposit_judge == 'y':
    deposit_num = raw_input("\nPlease input your want to deposit money:")
    if deposit_num.isdigit:
        deposit = shop.deposit(deposit_num, user_name)
        while True:
            deposit_judge_1 = raw_input('\n充值成功,现在余额为%s,是否继续充值[y/n]?' %
                                        shop.user(user_name)[user_name])
            if deposit_judge_1 == 'y':
                deposit_num = raw_input(
                    "\nPlease input your want to deposit money:")
                if deposit_num.isdigit:
                    deposit = shop.deposit(deposit_num, user_name)
                else:
Ejemplo n.º 15
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Pw @ 2015-11-03 02:54:07
# author: 郑集文
# Description: 购物车

from shop import shop
import os
#定义方法
shop=shop()

#初始化列表
car_list=[]
car_dict={}

os.system('clear')
print "\nWelcome my shop!\n" 
user_name=raw_input("Please input your name:")

#判断用户名
while True:
    try:
        balance=int(shop.user(user_name)[user_name])
        break
    except IOError,e:
        user_name=raw_input("\n无此用户请重新输入:")

print "\n\n您的余额为%d\n\n"%balance


#主程序
Ejemplo n.º 16
0
async def send(message: types.Message):

    await message.reply(
        f"🎁 <b>Добро пожаловать 🎁\n               в холишоп</b>",
        reply_markup=shop.shop("shop_main"))
Ejemplo n.º 17
0
from shop import shop
from datasql import datasql as data
from dataxml import dataxml

g1 = shop()
dat1 = data()
dat2 = dataxml()
dat2.read("old.xml", g1)
dat1.write("old.sqlite", g1)
g1.clear()
dat1.read("old.sqlite", g1)
dat1.write("new.xml", g1)

for s in g1.getOrderCodes():
    print(g1.getInfoOrder(s))
Ejemplo n.º 18
0
def iron_clan(player):
    the_map = mapify('iron_clan.txt')
    print_map(the_map)
    x = 15
    y = 15
    while True:
        o_x = x
        o_y = y
        print("\033[H", end="")
        print_map(the_map)
        the_map[y][x] = ' '
        key_pressed = getch()
        if key_pressed == 'w':
            y -= 1
        elif key_pressed == 's':
            y += 1
        elif key_pressed == 'd':
            x += 1
        elif key_pressed == 'a':
            x -= 1
        elif key_pressed == 'l':
            break
        if the_map[y][x] not in ('U', 'S', 'L', 'P', '|', '_', 'K', 'A', 'M',
                                 'B', 'G', 'Z', 'Q', 'D', 'x', 'R'):
            the_map[y][x] = 'player'
        elif the_map[y][x] == 'S':
            shop.shop(player)
        elif the_map[y][x] == 'P':
            ai_talk.speak_dude(player)
        elif the_map[y][x] == 'L':
            secret_lib_thing.library()
        elif the_map[y][x] == 'M':
            battle.battle(player)
        elif the_map[y][x] == 'D':
            multi_battle.duck_fight(player)
        elif the_map[y][x] == 'B':
            ai_talk.mega_rat(player)
        elif the_map[y][x] == 'U':
            ai_talk.ultra_thorg(player)
        elif the_map[y][x] == 'G':
            battle.monster_guard(player)
        elif the_map[y][x] == 'R':
            baba = random.randint(1, 2)
            if baba == 1:
                util.s_print(
                    "Ohno! It wasn't an octopus it was a Raider in disguise!")
                battle.yeckity_toe(player)
            else:
                util.s_print("Ohno! A wild octopus attacks!")
                damage = random.randint(1, 8)
                octo_damage = damage * 8
                util.s_print("The wild octopus attacks and deals " +
                             str(octo_damage) + " damage!")
                player['life'] -= octo_damage
                if player['life'] <= 0:
                    util.s_print("You were killed by a savage octopus")
                else:
                    util.s_print("You vicously strike the octopus with your " +
                                 player['main_weapon'] + " and kill it")
                    player['kills'].append("Wild Octopus")
                    player['weapons'].append("Octopus")
                    util.s_print("You got a new weapon: Octopus")
                    util.s_print(
                        "Note: Octopus and some other specialty weapons cannot be used against bosses"
                    )

        else:
            x = o_x
            y = o_y
Ejemplo n.º 19
0
def main():
	global hp, maxhp, atk, defense, monstersInfo, monstersList, shards, stones, money, items, xp, lvl, dungChunk, speed, waves
	if(waves > len(infoChunk)):
		print("Wow! Max waves? Very good! But...")
		waves = 1
		money += 100000
	while hp > 0:
		buffs[1] = 0
		buffs[0] = 0
		eventHandler(event)
		if(items[1][0] == 0):
			buffs[0] += 10
			buffs[0] += items[1][2]
		elif(items[1][0] == 1):
			buffs[0] += 15
			buffs[0] += items[1][2]
		elif(items[1][0] == 2):
			buffs[0] += 25
			buffs[0] += items[1][2]
		elif(items[1][0] == 'D'):
			buffs[0] += 40
			buffs[0] += items[1][2]
		if(items[1][1] == 0):
			buffs[1] += 5
			buffs[1] += items[1][3]
		elif(items[1][1] == 1):
			buffs[1] += 7
			buffs[1] += items[1][3]
		elif(items[1][1] == 2):
			buffs[1] += 13
			buffs[1] += items[1][3]
		os.system('cls')
		os.system('clear')
		if(mobsInChank == []):
			dungChunk = checkChunk()
			spawnChunk(isdung = False)
		if(int(dungChunk[0]) == 2):
			print("------------------------------")
			print("    This chunk is dungeon     ")
			print("            Enter?            ")
			print("0) Yes")
			print("1) No")
			print("2) Heal 50 hp(40 money, you have " + str(money) + " money and " + str(hp) + " hp") 
			print("------------------------------")
			b = input()
			if(int(b) == 0):
				spawnChunk(isdung = True)
				dung(items, mobsInChank)
			if(int(b) == 1):
				pass
			if(int(b) == 2 and money > 39 and hp < maxhp):
				hp += 50
				money -= 40
				if(hp > maxhp):
					hp = maxhp
				main()
		if(int(infoChunk[waves]) == 3):
			print("You unlocked city " + str(citesList[0][0]))
			citesList[0][1] = 1
		elif(int(infoChunk[waves]) == 4):
			print("You unlocked city " + str(citesList[1][0]))
			citesList[1][1] = 1
		print("Event today: " + str(eventList[event[0]]))
		if(hp > maxhp):
			hp = maxhp
		if(xp > 99):
			lvl += 1
			xp -= 100
			atk += 3
			defense += 2
			hp = maxhp
		if(showItems == True):
			print("------------" + Fore.CYAN + "Items" + Fore.RESET + "-------------")
			if(shards[0] != 0):	
				print("    Water shards: " + str(shards[0]))
			if(shards[1] != 0):	
				print("    Sun shards: " + str(shards[1]))
			if(shards[2] != 0):	
				print("    Air shards: " + str(shards[2]))
			if(stones[0] != 0):	
				print("    Water stones: " + str(stones[0]))
			if(stones[1] != 0):	
				print("    Sun stones: " + str(stones[1]))
			if(stones[2] != 0):	
				print("    Air stones: " + str(stones[2]))
			if(items[0] != 0):
				print("    Bones: " + str(items[0][0]))
			if(items[1] != 0):
				print("    Meat: " + str(items[0][1]))
		print("-------------" + Fore.CYAN + "Info" + Fore.RESET + "-------------")
		print("    This chunk is ", end = '')
		if(int(dungChunk[0]) == 0):
			print("empty", end = '')
		elif(int(dungChunk[0]) == 1):
			print("with chest", end = '')
		else:
			print("dungeon")
		print(", next chunk is ", end='')
		if(int(dungChunk[1]) == 0):
			print("empty")
		elif(int(dungChunk[1]) == 1):
			print("with chest")
		else:
			print("dungeon")
		print("    Money: " + Fore.YELLOW + str(money))
		print("----------" + Fore.CYAN + "Your stats" + Fore.RESET + "----------")
		print("    HP: " + Fore.RED + str(hp) + Fore.RESET + "/" + Fore.RED + str(maxhp + buffs[2]))
		print("    Speed: " + Fore.WHITE + str(speed))
		print("    Defense: " + Fore.WHITE + Style.DIM + str(defense) + " + " + str(buffs[1]))
		print("    Strength: " + Fore.BLUE + str(atk) + " + " + str(buffs[0]))
		print("    Exp: " + Fore.GREEN + str(xp) + Fore.RESET + "/" + Fore.GREEN + "100" + Fore.RESET + "; Lvl: " + Fore.MAGENTA + str(lvl))
		print("    Waves: " + str(waves))
		print("-----------" + Fore.CYAN + "Monsters" + Fore.RESET + "-----------")
		for a in range(0, len(mobsInChank)):
			print(str(a) + ") Monster: " + str(mobsInChank[a][1]) + ", Lvl: " + str(mobsInChank[a][2]))
		print("------------------------------")
		print("Q) Quit")
		print("0) Menu")
		print("1) Attack")
		print("2) Heal 50 HP(40 money)")
		print("3) Workshop")
		print("4) Open inventory")
		print("5) Shop")
		print("6) Save")
		if(citesList[0][1] == 1 or citesList[1][1] == 1):
			print("7) Teleport")
		try:
			b = input()
			if(b == ""):
				main()
			if(b == "Q" or b == 'q'):
				save()
				quit()
			if(int(b) == 0):
				save()
				menu()
			if(int(b) == 1):
				print("Enter number of monster: ")
				c = input()
				if(c == ""):
					main()
				if(int(c) > len(mobsInChank)):
					main()
				else:
					attackMob(int(c), isdung = False)
			elif(int(b) == 2 and money > 39 and hp < maxhp):
				money -= 40
				hp += 50
			elif(int(b) == 3):
				newItem = shop.Workshop(shards, stones)
				shards = newItem[1]
				stones = newItem[0]
			elif(int(b) == 4):
				newItem = shop.inv(stones, maxhp, defense, atk, items, hp)
				maxhp = newItem[0]
				atk = newItem[1]
				defense = newItem[2]
				stones = newItem[3]
				items = newItem[4]
				hp = newItem[5]
			elif(int(b) == 5):
				newItem = shop.shop(money, stones, items)
				money = newItem[0]
				stones = newItem[1]
				items = newItem[2]
			elif(int(b) == 6):
				save()
			if(int(b) == 7):
				if(citesList[0][1] == 1):
					print("1) Tp to city " + str(citesList[0][0]))
				if(citesList[1][1] == 1):
					print("2) Tp to city " + str(citesList[1][0]))
				if(citesList[0][1] == 1 or citesList[1][1] == 1):
					b = input()
					if(int(b) == 1):
						newItem = cityH(0, citesList, items, money)
						items = newItem[0]
						money = newItem[1]
					elif(int(b) == 2):
						newItem = shop.cites(1, citesList, items, money)
						items = newItem[0]
						money = newItem[1]
					else:
						pass
				main()
			else:
				main()
		except ValueError:
			main()
Ejemplo n.º 20
0
def main():

    # Wat do?
    while True:
        time.sleep(.3)
        print()
        print('**********************************')
        time.sleep(.3)
        print('* What do you want to do?        *')
        time.sleep(.3)
        print('* 1. Talk to Tavern Barkeep      *')
        time.sleep(.3)
        print('* 2. Shop                        *')
        time.sleep(.3)
        print('* 3. Explore Cave                *')
        time.sleep(.3)
        print('* 4. Use Items                   *')
        time.sleep(.3)
        print('* 5. Quit                        *')
        time.sleep(.3)
        print('**********************************')
        direction = input('> ')

        # Game info
        if direction == '1':
            time.sleep(.3)
            print(
                '\nWelcome visitor! Here you can use items, go shopping, take a rest, or go explore the abandoned cave outside of town!\n'
            )
            time.sleep(1)
            print('''Have a drink on the house!

    _.._..,_,_
   (          )
    ]~,"-.-~~[
  .=])' (;  ([
  | ]:: '    [
  .=]): .)  ([
    |:: '    |
     ~~----~~
     ''')
            time.sleep(1)

        # Go shopping
        if direction == '2':
            time.sleep(.3)
            shop(hero)

        # Go fighting
        if direction == '3':
            time.sleep(.3)
            cave(hero)

        # Use items
        if direction == '4':
            time.sleep(.3)
            use_items(hero)

        # Leave (sad face)
        if direction == '5':
            break

    pass
Ejemplo n.º 21
0
def interMission(display, health, ammunition, Mdamage, Rdamage, fuel, money, n):
    global playingMusic
    global startTime
    global soundLength

    nextMusic = musicToPlay()

    clock = pygame.time.Clock()
    pygame.font.init()

    if n == 0:
        playMusic("../Audio/Effects/InterMissionTut.wav")
    else:
        if random.randint(0, 1) == 0:
            playMusic("../Audio/Effects/TimeForMission.wav")
        else:
            playMusic("../Audio/Effects/Interlude.wav")

    damageAmount = 50
    interChange = 100
    numberWords = 3

    words = ["Interest", "Interject", "Interlude", "Interchange", "Intermezzos", "Internment", "Interabang", "Interannual", "Interiority", "Interjoin",
    "Interlining", "Interlarded", "Internality", "Interlayers", "Internecine", "Intertribal", "Intermingle", "Intersperse", "Intervene", "Interoffice",
    "Interplead", "Intergrade", "Interview", "Interstrand", "Intermixing", "Interlinear", "Internuncio", "Interplant", "Interracial", "Internship",
    "Internalise", "Intertill", "Interacting", "Interschool", "Interisland", "Interabang", "Internecine", "Interpose", "Interpret", "Intermingle",
    "Intergraph", "Interlude", "Interview", "Interannual", "Intergrade", "Interlayers", "Interlinear", "Internalise", "Interline", "Internment"
    ] # Words to display
    wordPairs = [True, False, False, True, False, True, True, False, True, False, False, True, True, False, True, False, False, True, True, False,
    False, True, True, False, True, False, True, False, False, True, True, False, True, False, False, True, True, False, True, False, True, False,
    True, False, True, False, False, True, False, True
    ] # Is the word correct?
    word = [words[n], words[n+1]]
    correct = wordPairs[0]

    wordIndex = n * numberWords * 2 - 2
    loopExit = False
    unclicked = True
    getNext = True
    latestButtonData = [0, (0, 0)] # Last mouse button used and where it was used
    itemsToDisplay = [] # Items to blit to screen, and where to put them

    backgroundImage = createBackground('../Images/Backgrounds/intermission.png') # Load and scale background

    itemsToDisplay.append((backgroundImage, (0, 0), 1)) # Add background to queue

    # Clickable items on screen and their locations
    screenItems = [
        screenItem('inter1', 5, 243, 382, 5, 243, 337, '../Images/Sprites/IntermissionButtonPressed.png', '../Images/Sprites/IntermissionButton.png'),
        screenItem('inter2', 413, 243, 800, 413, 243, 337, '../Images/Sprites/IntermissionButtonPressed.png', '../Images/Sprites/IntermissionButton.png')
        ]
    
    playBackground('../Audio/Music/intermission.wav')

    while not loopExit:

        if nextMusic.ready:
            nextMusic.play()

        # Event Handling
        for event in pygame.event.get():
            # If any mouse button is pressed
            if event.type == pygame.MOUSEBUTTONDOWN:
                latestButtonData[0] = event.button
                latestButtonData[1] = event.pos
                print("button %3d pressed in the position (%3d, %3d)" %(latestButtonData[0], latestButtonData[1][0], latestButtonData[1][1]))
            
            # If any mouse button is released
            if event.type == pygame.MOUSEBUTTONUP:
                unclicked = True
                for clickable in screenItems:
                    latestButtonData = [0, (0, 0)]
                    clickable.regular()

        for clickable in screenItems:
            if latestButtonData[0] == 1:
                if not playingMusic:
                    if (latestButtonData[1][0] >= clickable.xHitLow) and (latestButtonData[1][0] <= clickable.xHitHigh):
                        if (latestButtonData[1][1] >= clickable.yHitHigh) and (latestButtonData[1][1] <= clickable.yHitLow):
                            if (unclicked == True) and (clickable.isGray == False):
                                unclicked = False
                                getNext = True
                                clickable.clicked()
                                if clickable.name == "inter1":
                                    if correct == True:
                                        money += interChange
                                        playMusic("../Audio/Effects/coin.wav")
                                        nextMusic.add("../Audio/Effects/MissionRight.wav")
                                    else:
                                        health -= damageAmount
                                        playMusic("../Audio/Effects/damage.wav")
                                        if random.randint(0, 1) == 0:
                                            nextMusic.add("../Audio/Effects/MissionWrong1.wav")
                                        else:
                                            nextMusic.add("../Audio/Effects/MissionWrong2.wav")
                            
                                elif clickable.name == "inter2":
                                    if correct == False:
                                        money += interChange
                                        playMusic("../Audio/Effects/coin.wav")
                                        nextMusic.add("../Audio/Effects/MissionRight.wav")
                                    else:
                                        health -= damageAmount
                                        playMusic("../Audio/Effects/damage.wav")
                                        if random.randint(0, 1) == 0:
                                            nextMusic.add("../Audio/Effects/MissionWrong1.wav")
                                        else:
                                            nextMusic.add("../Audio/Effects/MissionWrong2.wav")
            
            if clickable.image != None:
                itemsToDisplay.append((clickable.image, (clickable.xPos, clickable.yPos), 0))
        
        textToBlit = createText(str(money), 'Comic Sand MS', 30, 262, 440)
        itemsToDisplay.append(textToBlit)
        textToBlit = createText(str(health), 'Comic Sand MS', 30, 430, 440)
        itemsToDisplay.append(textToBlit)
        textToBlit = createText(str(ammunition), 'Comic Sand MS', 30, 348, 440)
        itemsToDisplay.append(textToBlit)
        textToBlit = createText(str(fuel), 'Comic Sand MS', 30, 502, 440)
        itemsToDisplay.append(textToBlit)

        textToBlit = createText(str(word[0]), 'Comic Sand MS', 42, 107, 281)
        itemsToDisplay.append(textToBlit)
        textToBlit = createText(str(word[1]), 'Comic Sand MS', 42, 523, 281)
        itemsToDisplay.append(textToBlit)

        if not playingMusic:
            if getNext:
                if wordIndex >= (n * numberWords * 2 + numberWords * 2) - 2:
                    loopExit = True
                else:
                    getNext = False
                    wordIndex += 2
                    word[0] = words[wordIndex]
                    word[1] = words[wordIndex + 1]
                    correct = wordPairs[wordIndex]
        
        stopTime = time.time()
        if ((stopTime - startTime) > soundLength) and not pygame.mixer.get_busy():
            playingMusic = False

        display.fill(black)
        newDisp = []
        for item in itemsToDisplay:
            display.blit(item[0], item[1])
            if item[2] == 1:
                newDisp.append(item)
        itemsToDisplay = newDisp

        # Push to screen
        pygame.display.update()
        clock.tick(fps)

    pygame.mixer.music.stop()
    health, ammunition, Mdamage, Rdamage, fuel, money = shop.shop(display, health, ammunition, Mdamage, Rdamage, fuel, money)
    return (health, ammunition, Mdamage, Rdamage, fuel, money)
Ejemplo n.º 22
0
from shop import shop
from dataxml import dataxml as data

sho = shop()
dat1 = data()
dat1.read('old.xml', sho)
dat1.write('new.xml', sho)

for s in sho.getOrderCodes():
    print(sho.getInfoOrder(s))
Ejemplo n.º 23
0
        else:
            return 'game'
    elif c==3:
        win.clear()
        win.update()
        if start:
            return win,'shop'
        else:
            return 'shop'
    else:
        win.quit()
        sys.exit()
    
def cont(screen=None):
    while True:
        scr = title(None,None,None,False)
        if scr == 'game':
            main(ww,hh,win)
        elif scr == 'shop':
            shop.shop(win,1)

ww,hh,full=setup.setup()
win,scr = title(ww,hh,full,True)
if scr == 'game':
    main(ww,hh,win)
elif scr == 'shop':
    shop.shop(win,1)
cont(screen=scr)


Ejemplo n.º 24
0
def main():
    print_header()
    # player = start_choice()
    player = start()
    if not player:
        player = start_choice()
    info(player)
    sleep(1)
    active = True

    while active:
        option = menu()
        # Quest Option
        if option == "quest":
            if player.quest:  # check that a quest exists
                confirm = input("Start quest?: {} (y/n) \n>>>".format(
                    player.quest))
                if confirm.find("y") != -1:
                    # TODO: make a good system for this, cuz 2 lines of extra elifs per quest cant be great
                    # if player.quest == "Clap the Dragon":
                    #     quests.clap_the_dragon(player)
                    if player.quest == "Dab on Turtles":
                        quests.battle_turtles(player, 3)
                    elif player.quest == "Beat up the Developer":
                        quests.beat_the_dev(player)
                    elif player.quest == "Mess with Goblins":
                        quests.mess_with_goblins(player)
                    elif player.quest == "Ryan's Battle":  # test battle - only accessable via debug mode
                        quests.ryans_battle(player)
                    elif player.quest == "Defeat Ryan":
                        quests.defeat_ryan(player)
                    elif player.quest == "Defeat the Outlaws":
                        quests.defeat_outlaws(player)
                    else:
                        print("You don't have a quest!")
                else:
                    print(
                        "ok then be that way man all this work i do to launch quests and u be that way ok cool"
                    )
            else:
                print(
                    "You don't have a quest! Go find one before trying to start! There may be some in town..."
                )

        # Inventory Option
        elif option == "inventory":
            inventory.use_item(player)

        # Shop Option
        elif option == "shop":
            shop.shop(player)

        # Player Info
        elif option == "player":
            info(player)

        # Debug mode
        elif option == "debug":
            player.debug()

        # World Option
        elif option == "world":
            world.world_init(player)
            selection = world.select_world()
            if selection == "Test World":
                world.test_world(player)
            elif selection == "Start Town":
                world.start_world(player)
            elif selection == "Topshelf":
                world.topshelf(player)
            elif selection == "Ptonio" and "Ptonio" in player.metadata:
                world.ptonio(player)

        # Save the game!
        elif option == "save":
            data.save(player)
            data.save_settings(settings)
            print("[!] Saved game!")

        # I NEED HELP!!!
        elif option == "help":
            game_help()

        # Set some tings
        elif option == "settings":
            change_settings()

        # Exit Option
        elif option == "exit":
            # print("See ya later!")
            data.save(player)
            data.save_settings(settings)
            active = False
Ejemplo n.º 25
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Pw @ 2015-11-03 09:58:36
# author: 郑集文
# Description: deposit
import shop,os
shop=shop.shop()
#判断用户名
while True:
    user_name=raw_input("\nPlease input you name:")
    file_name=user_name+'.txt'
    if os.path.exists(file_name):
        break	
    else:
        print "\n未找到此用户名请重新输入."
	
#主程序 
deposit_judge=raw_input("\nDo you need to recharge [y/n]?")
if deposit_judge=='y':
    deposit_num=raw_input("\nPlease input your want to deposit money:")
    if deposit_num.isdigit:
        deposit=shop.deposit(deposit_num,user_name)
        while True:
            deposit_judge_1=raw_input('\n充值成功,现在余额为%s,是否继续充值[y/n]?'%shop.user(user_name)[user_name])
            if deposit_judge_1=='y':
                deposit_num=raw_input("\nPlease input your want to deposit money:")
                if deposit_num.isdigit:
                    deposit=shop.deposit(deposit_num,user_name)
                else:
                    print "\n请输入正整数\n。"
            elif deposit_judge_1=='n':
Ejemplo n.º 26
0
'''
Accept user input to determine string to modify and if they want a picture modified
Sam Minix
6/26/20
'''
import spongebob
import shop
text = input('Enter a quote: ')
newText = spongebob.spongebob(text)
print(newText)
photo = input('Would you like it on a photo, Y/N? ')
while True:
    if (photo not in ['Y', 'y', 'yes', 'N', 'n', 'no']):
        photo = input('Enter a valid input. would you like a photo Y/N? ')
    else:
        break

if (photo in ['Y', 'y', 'yes']):
    shop.shop(newText)

print("Thanks!")