商城系统
贩卖等级装备【每个装备都有多种属性的品类可以购买,可自定义扩充装备】:
法系:10级:审判系列 20:圣光系列 30:帝国系列40:幻系列
物理:10级:狂暴系列 20:永恒系列 30:苍穹系列40:神系列
价位和装备属性自定义
充值系统
需要输入银行卡和卡号(虚拟)进行验证,扣除费用,增加玩家金币数量:1RMB=1000金币
其他自由发挥,比如:
- 存盘功能
- 图形化界面
- 可配置道具
- 网络对战功能
- 多人对战等
def mall(): print('欢迎来到游戏商店') print('*'*40) gold = 5000 weapon_list=[] print('当前的金币为',gold) while True: print("1,购买法系装备") print("2,购买物理装备") print("3,删除装备") print("4,查看装备") print("5,退出") choice = int(input('请输入你的选择:')) if choice == 1: print('欢迎进入法系装备库') weapons = [['审判系列', 1000], ['帝国系列', 2950], ['圣光系列', 3400], ['幻系列', 4800]] for weapon in weapons: print(weapons) weaponname = input('请输入要购买的装备名称:') if weaponname not in weapon_list: for weapon in weapons: if weaponname == weapon[0]: if gold >= weapon[1]: gold -= weapon[1] weapon_list.append(weapon[0]) print('购买装备',weapon) else: print('金币不足,赶快充值去吧!') break else: print('输入装备名称错误') break if choice == 2: print('欢迎进入物理装备库') weapons = [['狂暴系列', 1000], ['永恒系列', 2950], ['苍穹系列', 3400], ['神系列', 4800]] for weapon in weapons: print(weapons) weaponname = input('请输入要购买的装备名称:') if weaponname not in weapon_list: for weapon in weapons: if weaponname == weapon[0]: if gold >= weapon[1]: gold -= weapon[1] weapon_list.append(weapon[0]) print('购买装备',weapon) else: print('金币不足,赶快充值去吧!') break else: print('输入装备名称错误') break if choice == 3: print('装备太多啦,快扔掉一点吧.........') if len(weapon_list) > 0: print('{}拥有的装备如下:'.format(weapon_list)) for weapon in weapon_list: print(weapon) while True: weaponname = input('请选择需要删除的装备名称:') if weaponname in weapon_list: weapon_list.remove(weaponname) for weapon in weapon_list: if weaponname == weapon[0]: gold += weapon[1] else: print('装备有误!') break if choice == 4: print('{}拥有的装备如下:'.format(weapon_list)) for weapon in weapon_list: print(weapon) print('总金币:', gold) if choice == 5: answer = input('确认要离开装备商店吗?(yes/no)') if answer == 'yes': break else: print('输入错误,请重新选择')
def recharge(): gold = 5000#金币 charge_list = {"123": "456"}#账号 charge_fee = {"123": 100}#密码 print('账号金币为1000') print('欢迎来到充值系统') print('1RMB = 1000金币') while True: option = str(input("充值请输入1,退出请输入2\n")) if option == '1': kahao = str(input('请输入充值卡号:')) if kahao in charge_list: chongzhimima = str(input('请输入充值密码:')) if chongzhimima == charge_list[kahao]: print("银行卡内余额" + str(charge_fee[kahao])) chongzhi_money = int(input('本次充值:')) while chongzhi_money > charge_fee[kahao]: print("余额不足") chongzhi_money = int(input('本次充值:')) gold = gold + chongzhi_money * 1000 charge_fee[kahao] = charge_fee[kahao] - chongzhi_money print('充值成功\n,现有金币' + str(gold)) if charge_fee[kahao] == 0: del charge_list[kahao] print('别打游戏了赶紧进厂吧') else: print('银行卡余额还有' + str(charge_fee[kahao])) else: print('密码错误') else: print('卡号不存在') elif option == '2': break else: continue